On Thu, Mar 18, 2010 at 12:00 PM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 18 Mar 2010, at 4:35pm, Alexey Pechnikov wrote: > >> sqlite> select count(*) from file_text; >> 8430 >> CPU Time: user 0.508032 sys 0.012000 > > Try counting just the primary key. Suppose your primary key is a column > called 'id', try > > SELECT COUNT(id) FROM file_text >
Afaik, that shouldn't make a difference, unless there is no primary key. If there is a PK, then Count(*) should work as well as Count(col). The issue with SQLite is that Count(whatever) is not optimized, hence, it is better to just keep track of the count in a separate table via TRIGGERs, and then query just that one row in that one "counts" table. This has been discussed ad nauseam on this list. Alexey's issue is that for the same query, his compressed file is slower than the non-compressed file. > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor http://www.punkish.org Carbon Model http://carbonmodel.org Charter Member, Open Source Geospatial Foundation http://www.osgeo.org Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor Nelson Institute, UW-Madison http://www.nelson.wisc.edu ----------------------------------------------------------------------- Assertions are politics; backing up assertions with evidence is science ======================================================================= _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users