Hello Michele, sqlite does not remember the number of records in a table. Therefore, counting them requires to scan the full table, which explains the slow perfornamce.
This topic has been discussed previously in this list. See http://www.mail-archive.com/sqlite-users@sqlite.org/msg10279.html If you need the result quickly, you have to maintain the rnumber of records yourself in a different table, perhaps using triggers. Martin Am 24.09.2010 10:13, schrieb Michele Pradella: > I have an SQLite DB of about 9GB with about 2.500.000 records. > I can't understand why the "select COUNT(*) from log" statement is > extremely slow, it takes me about 9-10 minutes! > I try with: > select COUNT(1) from logs > select COUNT(DateTime) from logs > same result. Have you idea of why it's so slow? > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users