One of the things I try to maintain when writing databases is that
whenever I start poking at a field with WHERE, said field gets an index
to its own, and then I leave it to the engine of choice (SQLite, MSSql,
MySQL) to decide to use the indexes. I have rarely been let down
performance wise.
If the initial sentence of your find holds true, does SQLite look at the
largest index and just makes the assumption that it should use THAT
index to do lookups?
On 01/27/2012 05:52 AM, Mohit Sindhwani wrote:
I was under the impression that SQLite only uses 1 index per table per
query (not sure where I got that idea).. it's interesting to not that
this works..! Is this the recommended way to optimize OR queries
involving 2 different fields of the same table?
But as I search the SQLite website again, I find:
Note that in most cases, SQLite will only use a single index for each
table in the FROM clause of a query. The second OR-clause optimization
described here is the exception to that rule. With an OR-clause, a
different index might be used for each subterm in the OR-clause.
Something learned, thanks!
Thanks,
Mohit.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users