J. R. Westmoreland <j...@jrw.org> wrote: > It is my understanding that if I use a wildcard at the front of the > string > then it will cause a linear table search rather than using the index > if the > string is the first part of the match. For example, "... col like > '%String'" > or "... col like '%String%'" would cause a linear table search > ignoring the > index.
Correct. > As opposed to "... col like 'String%'" which would still use > the > index for matching. _Might_ still use the index, if certain other conditions hold. See http://www.sqlite.org/optoverview.html section 4.0 The LIKE optimization. > Also, would the following only search part of the table in a linear > fashion? "select * from table where id >= 150 and id <= 1500 and col > like '%String%';" > This assumes that id and col are key and index respectively. This would likely use the index on id to satisfy the first two inequalities, then would lineraly scan all records that satisfy the conditions on id and test the LIKE condition on each one. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users