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 01 · Database Internals · One Database, to the Bolt · about 17 min to read

Play it as a journeyTutor comes with a plan

The sorted pile that grows: LSM internals

Storage Engines
Storage Engines · Open board

Before you start. B-Tree on Disk showed you the update-in-place way: every key has one home page, and a write goes to that page and sometimes splits it. WAL & Recovery gave you the log, a file where every change is written first so a crash can be replayed. Storage Engines named the other family, the log-structured merge tree, in a few lines. This lesson opens that family up. Nothing else is assumed.

Lesson 8 of 26 in Database Internals

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

  • The problem: writes that stall every few minutes
  • The memtable: a sorted pile in memory
  • The SSTable: a sorted file that is never edited
  • The bloom filter: a small memory that says “definitely not here”
  • Compaction: merging files so the pile stays short
  • Write amplification: how many times a byte is written

Terms it explains: memtable, SSTable, Bloom filter, compaction, Write amplification, Tiered compaction, Leveled compaction, Common mistakes, index, LSM, tombstone, WAL.

Lab

Write-heavy wants an LSM, read-heavy wants a B-tree. Where exactly is the flip?

Drag Share of the workload that is reads across its whole range and watch the winner under Who finishes first flip.

Open LSM vs B-tree

Related papers

Review Database Internals