Skip to content
Theory · ClickHouse: Aggregates, Materialized Views, MergeTree Engines · lesson 10 of 12

AggregatingMergeTree and function states

The daily totals need one more column: how many different menu items a shop sold. For one day that number takes one query. But a month cannot be added up from days: espresso sold every day, and in the sum of the daily numbers it would be counted thirty times.

In this lesson

  • The state of an aggregate function
  • The answer through -Merge
  • Choosing an engine
  • Common mistake
  • Key points