On Fri, May 7, 2010 at 5:57 PM, Griggs, Donald <donald.gri...@allscripts.com > wrote:
> > Sqlite using a maximum of one index per table per select. > > In order to perform your "OR" select, it must scan every the table. > That information is obsolete as of SQLite version 3.6.8 (2009-01-12). All versions of SQLite over the past 1.3 years will use separate indices for each term in a series of OR-connected terms if doing so will be faster than a full table scan. See http://www.sqlite.org/optoverview#or_opt for additional information. SQLite uses a cost-based query planner. That is to say, it attempts to estimate the total amount of work needed for each of various methods of computing a query and selects the one that involves the least amount of work. So if the right indices exist for a series of OR-connected terms, all the indices will be used. But sometimes, if there are many OR terms and some of the indices are not very selective, SQLite might decide that it is faster to do a full table scan than to do all of the index lookups. --------------------- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users