Database / ScyllaDB Interview questions
What is the difference between memtables and SSTables?
| Memtable | SSTable |
| In-memory, mutable structure holding recent writes. | Immutable, on-disk file holding flushed data. |
| Lost on crash unless replayed from the commit log. | Durable; survives restarts. |
| One active memtable per table per shard at a time. | Many SSTables accumulate over time and get merged via compaction. |
Every write lands first in the memtable (alongside the commit log for durability), so recent data is served straight from memory, which is fast. When a memtable fills up, it's flushed to disk as a new, immutable SSTable, and a read for a given row may need to check the memtable plus one or more SSTables, merging results together, since a row's data can be spread across several SSTables written at different times. Compaction periodically merges multiple SSTables into fewer, larger ones to keep this per-read merge work bounded.
More Related questions...