I have a table where columns a and b form a unique key for column c. In an attempt to speed up queries I added an index on a and b.
CREATE TABLE t(a TEXT, b TEXT, c TEXT, CONSTRAINT u UNIQUE(a,b)); CREATE INDEX iab ON t(a, b); But, an automatic index is being used even though it seems like the index terms should be usable according to the optimizer overview: sqlite> EXPLAIN QUERY PLAN SELECT * FROM t WHERE a="foo" AND b="bar"; 0|0|0|SEARCH TABLE t USING INDEX sqlite_autoindex_t_1 (a=? AND b=?) (~1 rows) Even if I disable automatic indexing, its still being created: sqlite> PRAGMA automatic_index = 0; sqlite> EXPLAIN QUERY PLAN SELECT * FROM t WHERE a="foo" AND b="bar"; 0|0|0|SEARCH TABLE t USING INDEX sqlite_autoindex_t_1 (a=? AND b=?) (~1 rows) What am I missing here? _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users