swecrets

MergeTree from First Principles

Mechanics

Build a correct mental model of how MergeTree actually stores and finds data, from first principles.

What this module covers

  • MergeTree table engine mechanics
  • Parts (immutable, created per insert)
  • Partitions (PARTITION BY)
  • Background merges and merge selection
  • Sparse primary index and granules (index_granularity)
  • ORDER BY as the (mostly) primary key
  • Data skipping indexes (minmax, set, bloom filter)

Lessons

  1. ✓1. Parts, Partitions, and Why Merges Happen in the Background16 min
  2. ✓2. Primary Keys Are Sparse Indexes16 min
  3. ✓3. ORDER BY Is the Primary Key (Mostly)16 min
  4. ✓4. Data Skipping Indexes and Their Limits17 min
MergeTree from First Principles — ClickHouse — swecrets