On 26 Dec 2016, at 3:14pm, MONSTRUO Hugo González <americasoftw...@gmail.com> 
wrote:

> I have a table with 726.000 registers.
> 
> SELECT COUNT(*) FROM MyTable << is very slowly
> 
> SELECT COUNT (RowId) FROM MyTable ORDER BY PrimaryIndex << is very FAST

While this is not a bug in SQLite, since it reaches the right answer, there is 
definitely something wrong with this.  Can you please check to see that you get 
similar timings in the SQLite shell tool.  If you do, please post the result of

SELECT sqlite_version()

Please also post the result of

PRAGMA integrity_check

To answer the questions in your post, using COUNT(*) is meant to always be the 
fastest way to count rows.  If it’s not, something is wrong.  Which appears to 
be the case with your own setup.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to