BareFeetWare <list....@barefeetware.com> wrote:
> On 12/06/2011, at 9:59 PM, Ian Hardingham wrote:
>> Once again, multiturnTable has a million rows, I have separate indexes on 
>> complete and player1 and player2  (should I also add
>> an index on player1, player2?) 
> 
> Yes. Since your query asks for player1 = ? AND player2 = ?, then SQLite will 
> look for an index in that order, so should benefit
> greatly from an index on (player1, player2). Since the query also has 
> complete = 1, I think you should change the order to match
> the index, ie:  
> 
> where player1 = ? and player2 = ? and complete = 1

SQLite is smart enough to automatically reorder expressions combined with AND 
to match an index.
-- 
Igor Tandetnik

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

Reply via email to