On 13 Mar 2011, at 11:43am, Ian Hardingham wrote: > SELECT * FROM multiturnTable WHERE rowid in (SELECT rowid FROM > multiturnTable WHERE player1 ='?' UNION ALL SELECT rowid FROM > multiturnTable WHERE player2 = '?') AND (complete=0 OR p1SubmitScore=0 > OR p2SubmitScore=0) AND p1Declined=0 AND p2Declined=0 > > multiturnTable has about 100,000 rows.
Do you have an index on (p1Declined,p2Declined) to make that part of the search trivial ? Do you need both the 'completed' and the 'submitted' clauses or does one imply the other ? Ignoring the subSELECTs, how many rows satisfy all the zeros clauses ? Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users