Database / RocksDB Basics Interview Questions
Describe the Read Path in RocksDB?
- A Get call for a key first checks the active MemTable, since that holds the most recent writes
- If not found there, it checks any immutable MemTables still waiting to be flushed
- It then checks SSTables starting at Level 0, using each file's Bloom filter to quickly skip files that definitely don't contain the key
- For files the Bloom filter can't rule out, the index block locates the right data block, and a binary search finds the exact entry
- This continues down through successive levels until the key is found, or every relevant level has been checked and the key is reported as not found
This layered search, from freshest to oldest data, is exactly why a single Get can, in the worst case, touch several different structures before returning an answer.
More Related questions...