Skip to content
All papers

The Log-Structured Merge-Tree (LSM-Tree)

Patrick O'Neil, Edward Cheng, Dieter Gawlick, Elizabeth O'Neil1996Acta Informatica

Read it on doi.org(opens in a new tab)

Why this one

This paper is the reason your write-heavy database is fast, and it predates every system you associate with it - RocksDB, Cassandra, LevelDB, ClickHouse's parts, the storage layer under half of the NoSQL world. The argument is about disks: random writes are expensive and sequential writes are cheap, so buffer everything in memory, flush it as a sorted run, and pay the sorting cost later in background merges instead of on the write path. Read it with the B-tree lesson beside you, because the whole thing is one trade - LSM moves cost from writes to reads and to background compaction; a B-tree does the reverse. Once that trade is in your head, choosing a storage engine stops being a matter of taste.

What to take away

  • Write amplification and read amplification are the two numbers that decide the argument. Know both for your workload.
  • Compaction is not a maintenance chore, it is the second half of the write.
  • Bloom filters are what keep the read path from degrading as the number of runs grows.

Reads with