LSM trees can do partial updates: how RocksDB's merge operator avoids read-modify-write

arpit_bhayani · x · 2026-12-06

The author debunks a common misconception: LSM trees don't only support full-value replacement via Put — modern implementations like RocksDB offer a merge operator that accepts deltas (e.g. +1 for a counter), avoiding read-modify-write cycles that defeat the LSM write-optimized design.

How it works

The trade-off: cost moves from writes to reads. If operands pile up faster than compaction folds them, reads must walk a long chain — read amplification. A hot counter never read, then read once, can be surprisingly slow.

LevelDB lacks this; RocksDB, Pebble, and others expose a similar Merger interface.

Original post →

More from coding & agent

coding & agent channel →