>> Is the "explain query plan" lying when it says it will use the index? >> Can I just slap a trailing "*" on the end of each parameter for it >> really use the index? >> > I'm not sure what you mean by "lying". When I try EXPLAIN QUERY PLAN > on a GLOB 'b' example, it reports that it will not use an index. Output of > the three cases below: > > C:\work\sqlite\misc\glob_index>type test.sql > DROP TABLE IF EXISTS t1; > CREATE TABLE t1 (word TEXT); > CREATE INDEX t1_word ON t1(word); > EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE word GLOB 'b'; > EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE word GLOB 'b*'; > EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE word = 'b'; > C:\work\sqlite\misc\glob_index>sqlite3 < test.sql > 0|0|TABLE t1 > 0|0|TABLE t1 WITH INDEX t1_word > 0|0|TABLE t1 WITH INDEX t1_word
Sorry, I should have stated sqlite version 3.5.1 as mentioned in an earlier email: sqlite3 SQLite version 3.5.1 sqlite> CREATE TABLE t1 (word TEXT); sqlite> CREATE INDEX t1_word ON t1(word); sqlite> EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE word GLOB 'b'; 0|0|TABLE t1 WITH INDEX t1_word sqlite> EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE word GLOB 'b*'; 0|0|TABLE t1 WITH INDEX t1_word sqlite> EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE word = 'b'; 0|0|TABLE t1 WITH INDEX t1_word _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users