<ahref="#Alternative:_Use_comparison"><spanclass="tocnumber">2</span><spanclass="toctext">Alternative: Use comparison</span></a>
</li>
<liclass="toclevel-1 tocsection-3">
<ahref="#Avoid_ORDER_BY"><spanclass="tocnumber">3</span><spanclass="toctext">Avoid ORDER BY</span></a>
<ul>
<liclass="toclevel-2 tocsection-4">
<ahref="#Alternative:_denormalize_the_table"><spanclass="tocnumber">3.1</span><spanclass="toctext">Alternative: denormalize the table</span></a>
</li>
<liclass="toclevel-2 tocsection-5">
<ahref="#Alternative:_multiple_where_clauses"><spanclass="tocnumber">3.2</span><spanclass="toctext">Alternative: multiple where clauses</span></a>
</li>
</ul>
</li>
<liclass="toclevel-1 tocsection-6">
<ahref="#Beware_bulk_INSERTs_into_a_table_with_a_PRIMARY_KEY"><spanclass="tocnumber">4</span><spanclass="toctext">Beware bulk INSERTs into a table with a PRIMARY KEY</span></a>
<ahref="#Get_a_Solid_State_Drive"><spanclass="tocnumber">6</span><spanclass="toctext">Get a Solid State Drive</span></a>
</li>
<liclass="toclevel-1 tocsection-9">
<ahref="#Use_an_INDEX_for_your_SELECTs.2C_especially_JOINs"><spanclass="tocnumber">7</span><spanclass="toctext">Use an INDEX for your SELECTs, especially JOINs</span></a>
</li>
<liclass="toclevel-1 tocsection-10">
<ahref="#Use_TRANSACTIONs_for_multiple_INSERT_.2F_UPDATE_.2F_DELETE"><spanclass="tocnumber">8</span><spanclass="toctext">Use TRANSACTIONs for multiple INSERT / UPDATE / DELETE</span></a>
<spanclass="mw-headline"id="Avoid_ORDER_BY">Avoid ORDER BY</span><spanclass="mw-editsection"><spanclass="mw-editsection-bracket">[</span><ahref="/wiki/Dev/Sqlite/Tips?action=edit&section_key=Avoid_ORDER_BY"title="Edit section: Avoid_ORDER_BY"class="xowa-hover-off">edit</a><spanclass="mw-editsection-bracket">]</span></span>
ORDER BY will do an expensive sort operation which may not use an index. This will come into play with multiple-table joins
</p>
<pre>
SELECT t1.id
FROM tbl1 t1
JOIN tbl2 t2 ON t1.id = t2.id
ORDER BY t2.age
;
</pre>
<p>
In most cases, SQLite will only apply one index. In this example, it will be the index for the JOIN. No index gets applied for the score column, even if one is available In some cases, SQLite will actually sort the result-set by the ORDER BY first, before it applies the WHERE.
<spanclass="mw-headline"id="Beware_bulk_INSERTs_into_a_table_with_a_PRIMARY_KEY">Beware bulk INSERTs into a table with a PRIMARY KEY</span><spanclass="mw-editsection"><spanclass="mw-editsection-bracket">[</span><ahref="/wiki/Dev/Sqlite/Tips?action=edit&section_key=Beware_bulk_INSERTs_into_a_table_with_a_PRIMARY_KEY"title="Edit section: Beware_bulk_INSERTs_into_a_table_with_a_PRIMARY_KEY"class="xowa-hover-off">edit</a><spanclass="mw-editsection-bracket">]</span></span>
<spanclass="mw-headline"id="Get_a_Solid_State_Drive">Get a Solid State Drive</span><spanclass="mw-editsection"><spanclass="mw-editsection-bracket">[</span><ahref="/wiki/Dev/Sqlite/Tips?action=edit&section_key=Get_a_Solid_State_Drive"title="Edit section: Get_a_Solid_State_Drive"class="xowa-hover-off">edit</a><spanclass="mw-editsection-bracket">]</span></span>
<spanclass="mw-headline"id="Use_an_INDEX_for_your_SELECTs.2C_especially_JOINs">Use an INDEX for your SELECTs, especially JOINs</span><spanclass="mw-editsection"><spanclass="mw-editsection-bracket">[</span><ahref="/wiki/Dev/Sqlite/Tips?action=edit&section_key=Use_an_INDEX_for_your_SELECTs.2C_especially_JOINs"title="Edit section: Use_an_INDEX_for_your_SELECTs.2C_especially_JOINs"class="xowa-hover-off">edit</a><spanclass="mw-editsection-bracket">]</span></span>
<li><ahref="http://dumps.wikimedia.org/backup-index.html"title="Get wiki datababase dumps directly from Wikimedia">Wikimedia dumps</a></li>
<li><ahref="https://archive.org/search.php?query=xowa"title="Search archive.org for XOWA files">XOWA @ archive.org</a></li>
<li><ahref="http://en.wikipedia.org"title="Visit Wikipedia (and compare to XOWA!)">English Wikipedia</a></li>
</ul>
</div>
</div>
<divclass="portal"id='xowa-portal-donate'>
<h3>Donate</h3>
<divclass="body">
<ul>
<li><ahref="https://archive.org/donate/index.php"title="Support archive.org!">archive.org</a></li><!-- listed first due to recent fire damages: http://blog.archive.org/2013/11/06/scanning-center-fire-please-help-rebuild/ -->