You end up withA durable key-value store you wrote, with a B+tree, crash recovery and transactions, a small SQL layer on top, and enough knowledge of PostgreSQL's internals to read its source.
Data pulled 2026-11-08 · time estimates are editorial
Why build one when an agent can write it for you? Because the next time your agent says “just add an index” or “wrap it in a transaction”, you’ll know what it’s really asking the disk to do. Hacker News has voted these tutorials up again and again for over a decade. Every step below shows its HN score and quotes what HN said.
How to read the receipts.
Points are summed across every HN submission of the same URL.
“Submitted N×” means HN rediscovered it N times.
Quotes come from the highest-ranked top-level comments in those threads, and a quote is sometimes a criticism.
Steps are ordered for learning, not by points.
Times are our estimates, not the authors’. They assume evenings and weekends, and a reader who already programs comfortably in at least one language. Expect to be faster or slower.
One long article covering the whole relational engine: query parser, optimizer, joins, buffer pool, locks, logging. Read it once, now, without trying to remember everything. You’ll come back to it.
“As complicated as they look from the article, it is just scratching the surface… there is probably more hardcore computer science per line of code than any other software system of similar scope.”
“Writing a database is a good exercise I could recommend to everybody.”
Editor’s note: the series ends at Part 14, “Splitting Internal Nodes”. It has no deletes, no transactions and no crash recovery, and the author marks it “no longer under active development”. Part 15 points readers to CodeCrafters through a referral link. Step 6 picks up where it stops: deletes, crash recovery and the free list are all in the free part of that book. (Checked 2026-11-08.)
5.
Compare your toy with the real thing: SQLite internals
Free · ~1 evening each. Read them with your step-4 code open.
HN acqq, 2014
“I really appreciate how Julia Evans enjoys experimenting in programming… compared to so many practitioners who just read the books and often uncritically ‘believe’ the written texts.”
Also recommended in the Fly.io thread: SQLite’s own design documents, especially “Atomic Commit In SQLite” and “How To Corrupt An SQLite Database File”.
“I recommend the excellent articles by the SQLite authors themselves … They go into the details of challenges SQLite faces due to how hardware and OSs work or not work and how they solve them.”
1,144 points, submitted 7× (2023–2025) · Part I free online; Part II paid (ebook via Leanpub, or paperback) · Go · ~4–6 weeks
The core of the track. It comes in two parts:
Part I, free on the web: a copy-on-write B+tree with insertion and deletion, crash recovery with fsync, an append-only key-value store and a free list.
Part II, only in the paid editions: tables, range queries, secondary indexes, atomic transactions, concurrency control, and a SQL-like parser and executor.
The whole book comes to about 3,000 lines with no dependencies, according to the 2025 edition’s announcement (422 points on its own).
Free route to the endpoint: do Part I. Step 7 then gives you the SQL layer, and the concurrency-control part of step 11 covers transactions. Part II is the paid shortcut that does both in one codebase. (Terms checked 2026-11-08.)
HN myth_drannon, 2025, in the nan.fyi thread
“I also recommend this free online book to build a database.”
Alternatives HN suggested in these threads:
PingCAP’s talent-plan project 1, a Bitcask in Rust (vrnvu, 2025).
Sciore, Database Design and Implementation, described as the only book with “actual examples of building a system that processes SQL” (ccleve, 2019). It has never been submitted to HN as a story.
Mini-LSM · Alex Chi Z · https://skyzh.github.io/mini-lsm/ · 121 points, submitted 2× (2024) · Free · Rust. Take this one for the log-structured (LSM) route instead of a B+tree. “…these tutorials he’s been putting out are fantastic.” (moab, 2024 · thread). The caveat in the same thread: “the language is a bit stilted and has many small grammar errors” (jiggawatts).
802 points, submitted 3× · Free: the whole book is on the web; ebook and paperback optional (checked 2026-11-08) · C/C++ · ~2–3 weeks
This one covers networking rather than storage: sockets, an event loop, a hash table, sorted sets, TTLs.
HN rcarmo, 2023, who builds a mini-Redis in every new language · thread
”…Redis is the quintessential network service: By implementing it, you learn about socket handling, event loop for a specific runtime, threading models, data representation, concurrency…”
In Rust instead: Tokio’s mini-redis tutorial (https://tokio.rs/tokio/tutorial; 72 points, submitted 4×). One warning from its thread: “Rust async programming is a bad way to learn about Rust, and also is a bad way to learn about async programming.” (sanxiyn, 2020 · comment)
One query traced through Postgres’s parser, analyzer, rewriter, planner and executor, all in the C source. Read it before step 9 so the big book has a skeleton to hang on.
The highest-scoring database resource in the dataset. It covers how a real engine handles the things your toy skipped: heap pages, MVCC, vacuum, the planner, the WAL, replication.
“These kinds of posts are my favorite part of HN… miles above the basic posts around the internet you get with searching – but not quite a full book yet.”
Next steps HN recommended in the same thread:
MIT 6.824’s Raft labs, free (bonobocop, 2025).
David Beazley’s “Rafting Trip”, a paid five-day course: “I have no financial or personal interest here; I just loved the course.” (cheeseprocedure, 2023)
The theory shelf (read alongside, not in sequence)
Book
HN signal
Cost
Read it during
Designing Data-Intensive Applications · Martin Kleppmann
610 points over 6 submissions; named in 680 comments
Paid book
Stages 3–5
Database Internals · Alex Petrov
308 points over 2 submissions; named in 343 comments
Paid book
Stages 3–4
Readings in Database Systems (“Red Book”) · Bailis, Hellerstein, Stonebraker · http://www.redbook.io/
“It will not appeal to the absolute novice to be sure. But for anyone else who has worked on systems for moving data… this book will show you how things (probably stuff you’ve done bits of pieces of) fit together…”
HN chrisseaton, 2019, on Database Internals
“The depth of a text book with the approachability of a typical working programmer’s book.”
“I definitely wouldn’t approach this like I would approach a textbook: it’s definitely not meant to be friendly introductory material. That said, once you have a bit of background, it’s a goldmine of a survey.”
HN filereaper, 2016, in the Shaughnessy thread · comment
“I found this paper ‘Architecture of a Database System’ [1] to be an excellent starting point…”
“…any software project that includes writing a database is, de facto, a database project.”
Editorial backlog
Checked against HN on 2026-11-08 (backlog_receipts.json). Not promoted:
Comer, “The Ubiquitous B-Tree” (1979): 6 points over 2 submissions. It’s a classic, but HN hasn’t voted for it. Add it only on editorial merit.
Sciore, Database Design and Implementation (SimpleDB): never submitted as a story, so it stays a comment-sourced alternative under step 6.
Promoted: the Red Book and “Architecture of a Database System” (theory shelf), Shaughnessy (Stage 4 warm-up), Mini-LSM (step 6 alternative) and Tokio mini-redis (step 8 alternative).
Method
Candidates came from 4,140 HN stories above 100 points matching tutorial-style title patterns, plus a database-specific topic pull: 332 database candidates in all.
Selection. The 21 resources here (16 core, plus 5 promoted from the backlog) were chosen by hand for followability and sequence. Points were then totalled across every submission of each URL.
Comment mentions are Algolia counts of comments containing the book title or domain.
Quotes come from the top five top-level comments of the two best-scoring threads per resource, in HN’s ranked order via the Firebase API. Some quotes are trimmed; links go to the full comment or thread.
Costs were checked on each site on 2026-11-08. Time estimates are editorial, not measured.
Data:tracks/databases/receipts.json (all resources cited above) and backlog_receipts.json (the backlog check). Scripts are in phase1-stories/scripts/.