<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 31/08/2026 à 22:34, Weston Renoud a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:DB8PR03MB55782506F6BECFE6C18442D099A92@DB8PR03MB5578.eurprd03.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">@scope { P {margin-top:0;margin-bottom:0;} }</style>
      <div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        Hey Even,</div>
      <div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div class="elementToProof"
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt;">
        <span style="color: rgb(0, 0, 0);">Removing the ORDER BY clause
          removed the need to materialize and gives the same query
          performance as with the temporary tables, but without the need
          to create any temporary tables which took extra time. Adding
          back just the "</span><span style="color: black;">ORDER BY </span><span
          style="color: rgb(0, 0, 0);">score" still avoided the
          materialize, it seemed to be the "</span><span
          style="color: black;">usage.auth_name, usage.code" that
          triggered the materialize. Are those necessary, or is "ORDER
          BY score" sufficient?</span></div>
    </blockquote>
    <p>They are only necessary for reproducibility of results among
      SQLite versions, in case of equality of score.  There is no
      guarantee otherwise that different SQLite versions would return
      the same ordered result set. So they would need to be replicated
      on the C++ side ( <a class="moz-txt-link-freetext" href="std::sort()">std::sort()</a> with an appropriate sort lambda)</p>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.
LLMs contribute to global warming and brain rot.
Let's guillotine them! "Ah ! ça ira, ça ira, ça ira !"</pre>
  </body>
</html>