On 4 Jan 2010, at 3:44pm, Jeremy Zeiber wrote:

> Believe it or not, these indexes made the query run the fastest:
> CREATE UNIQUE INDEX idx1 ON detail(headerid,data);
> CREATE UNIQUE INDEX idx2 ON detail(data,headerid);

That makes perfect sense since your SELECT command does require sorting by both 
fields.  Another approach would be to temporarily create those two indexes 
/and/ indexes on the two columns individually, /and/ any other indexes you 
think might help, and then to use the 'EXPLAIN' (or is it 'EXPLAIN QUERY PLAN' 
?) command to see which indexes are being used by your SELECT commands.  Then 
you can just delete the indexes which are not being used.

http://www.sqlite.org/lang_explain.html

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to