Gabriel Corneanu wrote: > I was surprised to find that simple query "select count(*) from table" took > too much time, and found that it does NOT use the primary key index??
In SQLite, indexes are stored as B-trees, ordered by the indexed columns. Tables are _also_ stored as B-trees, ordered by the rowid. This means that if the primary key is the rowid, the table _is_ the index corresponding to the primary key. (There is no separate index structure in this case.) > If I use CREATE TABLE t(a unique), then it uses the auto-generated cover > index. Because any index has exactly the same number of entries as its table, but is likely to occupy fewer pages. Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users