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?? e.g. CREATE TABLE t(a); explain query plan select count(*) from t
I get : SCAN TABLE t (~1000000 rows) If I use CREATE TABLE t(a unique), then it uses the auto-generated cover index. Even if I write select count(rowid) from t it still uses scan table... However I would expect that it should also use the primary key for counting, or not?? In my opinion, count(*) is the same as count(rowid) (I see that even count() is accepted); I could say it's even the same as count(x) (any other field). Strange is, count(*) uses the cover index for a but "select count(a)" does NOT use the same cover index... Am I making any mistake here?? Thanks, Gabriel _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users