What is the most efficient way to count rows in a table in SQLite?

The best way is to make sure that you run SELECT COUNT on a single column (SELECT COUNT(*) is slower) – but SELECT COUNT will always be the fastest way to get a count of things (the database optimizes the query internally).

If you check out the comments below, you can see arguments for why SELECT COUNT(1) is probably your best option.

Leave a Comment

tech