Track · 2:32 · Liner note

Under the MergeTree

MergeTree is the core table engine family in ClickHouse, which stores data as sorted, immutable parts with a sparse primary index and merges those parts in the background.

Look beneath a ClickHouse table and you usually find MergeTree: data written as sorted, immutable parts, each with a sparse primary index that points at blocks of rows, stitched together by background merges. Under the MergeTree is the quiet engine room of that design.

Three choices shape almost everything: the ORDER BY key that sorts each part, the partition key that groups parts and the insert pattern that decides how many parts exist. Get those right and a great deal of the tuning is already done.