Leveled compaction
Leveled compaction organizes sorted data into levels with size targets and merges selected data with overlapping key ranges in a destination level.
In RocksDB, each nonzero level is one sorted run partitioned across SST files with nonoverlapping key ranges within that level; L0 can contain multiple overlapping runs. One run is not necessarily one file. [1] Compared with tiering, leveling usually trades more rewriting for fewer candidate runs and lower space overhead, but workload skew and file-selection policy affect that trade-off. RocksDB's L0 makes its Level policy a tiered-plus-leveled hybrid. [2]
Relations
- related
- Log-structured merge-tree, LSM compaction, Tiered compaction, Read amplification, Space amplification, Sorted string table, Sorted run, Lazy leveling, Fluid LSM-tree
Citations
- RocksDB project. Leveled Compaction: sorted runs and the L0 exception.
- RocksDB project. Compaction: leveled, tiered and hybrid policies.