Watch SQLite read its own file
A database is one file cut into 4 KB pages, and every query is a walk across them. This is the real SQLite engine, and every page it touches lights up in the order it read it.
pages read
How it's built
- The real engine. The official SQLite WebAssembly build runs in a worker, behind a virtual file system written in TypeScript that logs every page SQLite reads.
- Cold cache on every run. Each run opens a fresh connection with an empty page cache, so the walk is exactly the pages that query needs, and the same query always walks the same way.
- Ownership from
dbstat. The tint of each tile comes from SQLite's own page statistics: which table or index owns it, and where it sits in its B-tree. - Guarded SQL. An authorizer callback (not a regex) refuses writes,
ATTACHand extensions; a progress handler stops runaway queries after 3 seconds, and a watchdog restarts the worker. - This page costs no WebAssembly. The walk above is a trace recorded from the engine at build time; the engine loads only when you open the workbench.
Part of a set of small, finished things at talhamunir.dev.
Index Golf
Loading today's puzzle…
Type one CREATE INDEX to see what it costs. Lower is better.
pages read
Page map as a table
Video export is not supported in this browser.
Ctrl or Cmd + Enter runs the last statement
Run a query: the tree each object grew shows up here, with the pages the walk visited lit.
Click any tile on the map to look inside that page.
Run the query on your current database and on the untouched one, side by side.