liveBook · Manning

Compaction strategy

As explained in ScyllaDB in Action

A compaction strategy is a table-level policy that determines how SSTables are grouped and merged.

A compaction strategy is a table-level policy that determines how SSTables are grouped and merged. Compaction removes obsolete data created when repeated row updates leave multiple versions across SSTables, helping prevent database growth and increasingly slow reads. section 8.4.1

ScyllaDB supports these strategies:

  • Size-tiered compaction (STCS) groups similarly sized SSTables into buckets and compacts a bucket when it reaches capacity. It is the default and usually produces fewer, larger SSTables, but may delay obsolete-data removal and require substantial temporary disk space. section 8.4.1

Choosing and changing a strategy

A table can select STCS during creation with `WITH compaction = {'class': 'SizeTieredCompactionStrategy'}`. An existing table can be changed to LCS with `ALTER TABLE reviews.authors WITH compaction = {'class': 'LeveledCompactionStrategy'};`.

How ScyllaDB in Action covers it

How deep it goes
Explains STCS grouping, triggers, benefits, and disk-space drawbacks while summarizing LCS and TWCS more briefly.
Examples
Uses repeated bio updates, STCS bucket compaction, strategy configuration statements, and diagrams of LCS levels and TWCS windows.
What you can do after
Operate/configure tables by selecting a compaction strategy during creation or changing it with ALTER TABLE.
How it connects
Connects compaction strategies with SSTables, obsolete data, row updates, reads, partition keys, and time-series data.

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.