Tim Romano wrote:
> If the implementation of SQLite you are using overrides the LIKE operator
> (as more than a few do), then SQLite will not make use of an index on the
> column in question. Use the GLOB operator instead.
> 
> For example, I have a lexicon containing 263,000 words:
> 
> select count(*) from lexicon where spelling like 'a%'   // 552 ms on first
> run and then 355ms on second and subsequent runs
> select count(*) from lexicon where spelling glob 'a*'  // 110 ms on first
> run and then ~10ms on second and subsequent runs

Note that, by default, LIKE is case-insensitive while GLOB is case-sensitive. 
Thus, even if not overridden with a custom function, LIKE cannot be optimized 
unless the column is declared with NOCASE collation. Again, this article 
provides all the details: http://sqlite.org/optoverview.html#like_opt
-- 
Igor Tandetnik

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

Reply via email to