tursodatabase / tursodatabase/libsql
Optimize COUNT(*) in terms of rows read metrics
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 17.2k
- Forks
- 531
- Avg merge
- 1h 12m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how SELECT COUNT() currently contributes to rows-read metrics, comparing queries with and without a WHERE clause. Define completion as COUNT() avoiding linear row reads where caching is valid, reporting constant-time behavior and reading only one row, while preserving correct results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, sqlite
- Domain
- databases, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100