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

TL;DR

SummingMergeTree automatically sums numeric columns during merges, pre-aggregating counters and metrics. Put all dimension columns in the sorting key. Use GROUP BY in queries for reliable aggregation.

How It Works

SummingMergeTree automatically sums numeric columns during merges, using the sorting key as the group key. All numeric columns are summed for each unique combination of sorting key values.

CREATE TABLE page_views ( date Date, user_id UInt64, views UInt64 ) ENGINE = SummingMergeTree() ORDER BY (date, user_id);

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

SummingMergeTree | ClickHouse for Developers