Skip to content
Pagewalk

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.

Open the workbenchHow it's built

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, ATTACH and 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.