Index

Module 05 · From ScratchDatabase

Build Your Own Database - From Scratch

The Map
The Map · Open board

The whole build, laid out in the order its own walls forced it.

Boards

Code: teaching/code/from-scratch/database/ - one Go module, go run ./NN-stage. Real files, a real B-tree (verified: 1000 keys, height 6, in-order sorted), real crash recovery, real MVCC snapshots, a tiny SQL planner.

Before you start. This series builds a small copy of a database - a program that keeps rows of data on disk, finds any one of them in an instant, survives the machine dying mid-write, and lets more than one program read and write at once without corrupting each other’s work. It’s the fourth build in the From Scratch track; if you built the small cache or the small message log earlier in it, you already know the shape - start from the plainest file that could work, and add exactly one new mechanism each time it hits a wall it can’t get past on its own.


Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Review From Scratch →

Saved in this browser, and to your account when you sign in.