Hi, Seriously... it can only use one index per query? I tried your union suggestion and it works well, thank you. I had no idea it was limited to a single index.
Thanks Ray Griggs, Donald-3 wrote: > > Regarding: > select * from table1 where field1='x' or field2='y' > > > Hi, Ray, > > I believe you sent two messages -- the first with "OR" and the second with > "AND". > > Since your subject consistently says "OR" and your last email says "AND" > I'll assume you meant "AND". > > > Sqlite using a maximum of one index per table per select. > > In order to perform your "OR" select, it must scan every the table. > > You may want to create a compound index of both fields. > > (Or maybe a "UNION ALL" would be fast? You can use EXPLAIN QUERY PLAN to > analyze.) > > > Hope this helps, > Donald > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://old.nabble.com/Very-Odd...-where-field1%3D%27%27-or-field2%3D%27%27-is-slow-tp28491829p28492061.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users