How to Build a Database
summary
A tiny readable database called Wormwood is implemented as 660 lines of TypeScript that reads newline JSON FIFA records, parses SQL-like strings into a parser → planner → executor pipeline, builds an iterator-based dataflow graph, and supports SELECT/WHERE/ORDER BY plus a mean aggregate. Indexes are JSON maps of value → line numbers; adding one speeds an example query from 244ms → 147ms but still forces slow text-file line scans.
AI-written summary · about
chapters (12)
- 0:00Database building introduction
- 4:46Wormwood demo introduction
- 8:04SQL as data pipeline
- 13:21Iterator model in engines
- 16:52Parsing SQL queries
- 21:56Parser functions in Wormwood
- 29:45Query planning basics
- 32:16Complexity analysis
- 37:18Indexes for performance
- 43:35Wormwood indexes execution
- 46:40Wormwood source code
- 47:09Q&A on implementation








