Count() might still have to visit each row because there might also be a where clause.
select count(toys) in toybox where wheels=4; (pardon rusty SQL plz) On Mon, Aug 2, 2010 at 1:37 PM, Scott Hess <sh...@google.com> wrote: > On Mon, Aug 2, 2010 at 11:11 AM, Simon Slavin <slav...@bigfraud.org> > wrote: > > On 2 Aug 2010, at 7:06pm, Richard Hipp wrote: > >> Most of the slow queries seem to be "SELECT count(*) FROM ....". Such > >> queries have to visit every row in the table (in order to count the > rows) > >> and thus get progressively slower as the number of entries in the > database > >> increases. > > > > Might there be a way to optimize count() ? After all, the number of rows > in > a table is probably held somewhere convenient. > _______________________________________________ > 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