The query below takes about 10 mins to run, any idea why this would be? select ID FROM rtable WHERE search > 0 and MD5 is NULL and isf = 0 ORDER BY afo
The same query without the ORDER BY takes a few seconds. select ID FROM rtable WHERE search > 0 and MD5 is NULL and isf = 0 There are approximately 800K rows in the table and all columns are indexed explain query plan gives the following for the initial query 0|0|0 SEARCH TABLE rtable USING INDEX md5_a (md5=?) (~2 rows) 0|0|0 USE TEMP B-TREE FOR ORDER BY without the ORDER BY I get just 0|0|0 SEARCH TABLE rtable USING INDEX md5_a (md5=?) (~2 rows) it seems that the extra time is taken creating a b-tree for the order by but if correct why is the existing index not used? is there anyway of speeding this up? _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users