tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
9.44k stars 248 forks source link

Optimize COUNT(*) in terms of rows read metrics #160

Open psarna opened 1 year ago

psarna commented 1 year ago

Issuing a SELECT COUNT(*) will currently bump the number of rows read linearly to the number of rows. COUNT() results can be rather easily cached however (esp. without any WHERE clause), and then we could offer constant time COUNT () support which only reads a single row.

psarna commented 1 year ago

Refs libsql/libsql#328