Hi,

I have a problem with a missing use of an index.

My Example:
sqlite> create table tab1 (o INT, a INT, b INT,UNIQUE(o,b));

sqlite> select * from sqlite_master;
table|tab1|tab1|2|CREATE TABLE tab1 (o INT, a INT, b INT,UNIQUE(o,b))
index|sqlite_autoindex_tab1_1|tab1|3|

=>      I expect that the index "sqlite_autoindex_tab1_1" is on column o and b?

sqlite> explain query plan SELECT * from tab1 WHERE o=1;
0|0|0|SEARCH TABLE tab1 USING INDEX sqlite_autoindex_tab1_1 (o=?) (~10 rows)

=>      OK:  "sqlite_autoindex_tab1_1" is used

sqlite> explain query plan SELECT * from tab1 WHERE a=1;
0|0|0|SCAN TABLE tab1 (~100000 rows)

=>      OK:  "sqlite_autoindex_tab1_1" is not used because a is not indexed.

sqlite> explain query plan SELECT * from tab1 WHERE b=1;
0|0|0|SCAN TABLE tab1 (~100000 rows)

=>      NOK:  Why is "sqlite_autoindex_tab1_1" not used?

My Version:
SQLite 3.7.7.1 2011-06-28 17:39:05

Thanks

Maik


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

Reply via email to