Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 07 · From Scratch · Database · with code: Go · about 23 min to read

Play it as a journeyTutor comes with a plan

Database 01: The Append-Only File

The Append-Only File
The Append-Only File · Open board

The first board in this database build that writes anything to disk at all. Hands off to Database 02: The Index, which fixes the read, and Pages, which fixes the file.

Before you start. This series builds a small copy of a database: a program whose only job is to remember things you hand it, and hand them back correctly later. You do not need to have built one before. You do need one fact about computers: they have two kinds of storage, one that forgets everything the moment the power goes and one that does not, and this lesson lives entirely in the second kind.

Lesson 46 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 2008: Riak makes a promise its engineers still have to keep
  • The rule that decides everything: add a line, never rewrite one
  • The trouble: how do you erase an entry you can only add to?
  • Why a crash can only cost you the last, unfinished line
  • The bill comes due: finding one entry means rereading the whole ledger
  • Basho’s other half: burn the old lines, keep only the truth

Terms it explains: key, value, tombstone, fsync, index, compaction, write-ahead log, position, write amplification.

Related paper

Review From Scratch