Algorithms and Data Structures · Senior · Question 15 of 75
What trade-off do LSM trees make compared with B-trees?
- ✓Correct answer: Faster batched writes, but slower reads and compaction
- 2Faster reads through caching, at the cost of slower writes
- 3Less disk space, at the cost of losing range queries
Explanation
Writes go to memory and are flushed as sorted files, so disk writes are sequential. Reads may check several files (Bloom filters help), and background compaction merges them. Cassandra, RocksDB and LevelDB use LSM trees.