When would you choose an LSM-based store over a B-tree based one?
Sketch your own answer first, then compare it with the one below.
A strong answer
Pick an LSM tree when the workload is write heavy and the data is much larger than memory. Writes are sequential, so a disk absorbs a high rate of inserts, and compaction can pack data densely.
Pick a B-tree when reads, especially range scans and point reads with a tight latency target, matter most, or when you want predictable latency. A B-tree reads one place per level and has no background merging that competes for I/O.
A good answer names the trade-off both ways. An LSM tree has background work and read cost that varies. A B-tree pays random page writes.
Sources
- Chen Luo, Michael J. Carey (2020). LSM-based storage techniques: a survey.