Database / RocksDB Basics Interview Questions
What is Compaction in RocksDB?
Compaction is the background process that merges multiple SSTables together, removing outdated or deleted data and keeping the overall storage structure efficient to read from.
- Combines SSTables with overlapping key ranges, producing a smaller number of more organized files
- Physically removes data that was overwritten or explicitly deleted, reclaiming disk space
- Runs automatically in the background, without requiring the application to trigger it manually
Without compaction, the number of SSTables would keep growing indefinitely, and reads would get progressively slower as more and more files needed to be checked for a given key.
More Related questions...