Unlock this content

Enter your email to unlock this content for free

By continuing, you agree to our Terms of Service and Privacy Notice, and to receive occasional marketing emails.

SummingMergeTree vs AggregatingMergeTree

TL;DR

SummingMergeTree is simple and fast for sum operations. AggregatingMergeTree handles complex aggregations (averages, unique counts) but requires AggregateFunction types and State/Merge functions. Start with SummingMergeTree unless you need complex aggregations.

Key Differences

FeatureSummingMergeTreeAggregatingMergeTree
OperationsSum onlySum, avg, uniq, quantile, etc.
FunctionsRegular SQL functionsState/Merge functions required
ComplexitySimple, out-of-the-boxRequires AggregateFunction types
Use caseSimple counters, metricsComplex analytics, dashboards
Use SummingMergeTree for simple sums. Use AggregatingMergeTree when you need averages, unique counts, or other complex aggregations that SummingMergeTree can't handle.

Code Comparison

Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.

SummingMergeTree vs AggregatingMergeTree | ClickHouse for Developers