Skip to main content
Skip to main content

MergeTree Engine Family

Table engines from the MergeTree family are the core of ClickHouse data storage capabilities. They provide most features for resilience and high-performance data retrieval: columnar storage, custom partitioning, sparse primary index, secondary data-skipping indexes, etc.

Base MergeTree table engine can be considered the default table engine for single-node ClickHouse instances because it is versatile and practical for a wide range of use cases.

For production usage ReplicatedMergeTree is the way to go, because it adds high-availability to all features of regular MergeTree engine. A bonus is automatic data deduplication on data ingestion, so the software can safely retry if there was some network issue during insert.

All other engines of MergeTree family add extra functionality for some specific use cases. Usually, it's implemented as additional data manipulation in background.

The main downside of MergeTree engines is that they are rather heavy-weight. So the typical pattern is to have not so many of them. If you need many small tables, for example for temporary data, consider Log engine family.

PageDescription
AggregatingMergeTreeReplaces all rows with the same primary key (or more accurately, with the same sorting key) with a single row (within a single data part) that stores a combination of states of aggregate functions.
Approximate Nearest Neighbor Search with Vector Similarity IndexesApproximate Nearest Neighbor Search with Vector Similarity Indexes
CollapsingMergeTreeInherits from MergeTree but adds logic for collapsing rows during the merge process.
Custom Partitioning KeyLearn how to add a custom partitioning key to MergeTree tables.
GraphiteMergeTreeDesigned for thinning and aggregating/averaging (rollup) Graphite data.
Full-text Search using Full-text IndexesQuickly find search terms in text.
MergeTreeMergeTree-family table engines are designed for high data ingest rates and huge data volumes.
ReplacingMergeTreediffers from MergeTree in that it removes duplicate entries with the same sorting key value (ORDER BY table section, not PRIMARY KEY).
Data ReplicationOverview of Data Replication in ClickHouse
SummingMergeTreeSummingMergeTree inherits from the MergeTree engine. Its key feature is the ability to automatically sum numeric data during part merges.
VersionedCollapsingMergeTreeAllows for quick writing of object states that are continually changing, and deleting old object states in the background.