← All benchmarksSQL
SQLite index on 5 million rows: 0.06 ms vs 403 ms per query
How much does an index speed up a lookup on 5 million rows?
In SQLite, a customer_id lookup on 5 million rows took 403 ms per query with a full table scan and 0.06 ms with an index (about 6,400x faster); the index took 3.8 s to build.
Results
| no index (SCAN) | 403 ms/query |
|---|---|
| with index (SEARCH) | 0.06 ms/query |
| index build | 3.8 s once |
How it was measured
In-memory SQLite, 5,000,000 rows.
CREATE INDEX idx_c ON orders(customer_id);Why
The index lets the engine jump to matching rows instead of reading every row.
When this does not apply
Indexes cost disk and write speed.
Environment
MacBook Air (Apple silicon, 8 cores), macOS, SQLite. Measured 2026-10-12.
Source: shorts/demo-ticket/cost/idx.py in my content-engine repository. Treat any single run as a direction; re-run it on your hardware.
Related
By Josué Barros, senior software engineer (full-stack, data and AI).