AlgoViz

SSTable

medium 24 min

A sorted string table is a file of key-value pairs in key order that never changes after it is written.

Where it shows up

The same pattern appears across everyday software.

  • Bigtable and HBase

    The Bigtable paper made the SSTable known. HBase's HFile format is based on that description.

  • LevelDB

    A small library whose files are sorted tables with data blocks, meta blocks, an index block and a fixed-length footer.

  • RocksDB

    Started as a fork of LevelDB. Its block-based table keeps the same idea and adds more kinds of meta blocks.

  • Cassandra and ScyllaDB

    Both store immutable SSTables. Cassandra sorts the partitions inside a file by the hash of their key, and version 5.0 adds a format with a trie as its index.

  • CockroachDB and TiKV

    CockroachDB uses Pebble, an engine inspired by RocksDB. TiKV uses RocksDB itself.

  • Time series and logs

    Metrics, sensor data and message feeds arrive in large numbers and are rarely changed, so writing sorted files in batches fits them well.