liveBook · Manning

SSTable

As explained in ScyllaDB in Action

An SSTable is an immutable on-disk file containing sorted database data produced by flushing in-memory state.

An SSTable, short for sorted strings table, is an immutable on-disk file that stores ScyllaDB data. When an in-memory memtable reaches its configured size, ScyllaDB flushes it to disk as an SSTable. Later updates and deletes create new data rather than modifying the existing file. section 6.2.2 section 6.6

At its core, an SSTable contains sorted key-value mutations. A key combines a row key and timestamp; a value records an insert, update, or delete. The sort order follows the table's primary-key definition, including its partition and clustering keys. section 8.3.3

SSTables shape both writes and reads:

  • Writes are buffered in a memtable and persisted in the commit log before a flush creates an SSTable. section 6.2.2
  • A read may need to reconcile the memtable with multiple SSTables holding the same partition to return the newest value. section 6.2.2
  • Compaction combines multiple SSTables into a new SSTable as files accumulate. section 6.6

Inspecting flushed review data

Run nodetool flush to force memtable data to disk, then use scylla sstable dump-data on an SSTable in the table directory. The dump shows a partition key, clustering information, timestamps, and stored column values such as an author's bio. section 8.3.3

(scylla-1) $ scylla sstable dump-data \
  $(pwd)/long-example-version-big-Data.db \
  --keyspace reviews --table authors
{
  "sstables": {
    "me-3gdx_1m6x_5i9cg297kgbxs0iicb-big-Data.db": [
      {
        "key": {
          "token": "6676340635825406971",    #1
          "raw": "0010eff9bd014a7311ee8863c02b3f99d2b2",
          "value": "eff9bd01-4a73-11ee-8863-c02b3f99d2b2"   #2
        },
        "clustering_elements": [
          {
            "type": "clustering-row",
            "key": {
              "raw": "",
              "value": ""
            },
            "marker": {
              "timestamp": 1708894607216077
            },
            "columns": {
              "bio": {              #3
                "is_live": true,
                "type": "regular",
                "timestamp": 1708894607216077,
                "value": "Alice loves writing about food"
              },
              "name": {            #4
                "is_live": true,
                "type": "regular",
                "timestamp": 1708894607216077,
                "value": "Alice Author"
              } } } ] } ] } }        #5

The dump makes an SSTable concrete: it exposes stored keys, mutation timestamps, and column values rather than treating the file as an opaque database artifact. section 8.3.3

How ScyllaDB in Action covers it

How deep it goes
Defines file creation, immutability, sorted mutations, read reconciliation, and compaction without detailing compaction mechanics.
Examples
Demonstrates forcing a flush and dumping an authors-table SSTable containing an author's bio.
What it assumes
Assumes familiarity with partition keys and clustering keys while explaining their role in SSTable sort order.
What you can do after
Operate/configure it by flushing memtables and inspecting resulting SSTable contents with ScyllaDB tools.
How it connects
Connects SSTables to memtables, commit logs, primary keys, tombstones, compaction, and Bloom filters.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.