Using Aggregate Combinators in ClickHouse(clickhouse.com)
clickhouse.com
Using Aggregate Combinators in ClickHouse
https://clickhouse.com/blog/aggregate-functions-combinators-in-clickhouse-for-arrays-maps-and-states
3 comments
Also, ClickHouse is the only DBMS implementing aggregate function states as data types to allow them to be stored in tables, saved, loaded, and merged.
It allows incremental, continuous aggregate tables.
Other DBMSes like TimescaleDB implement a similar feature in a less generic way.
It allows incremental, continuous aggregate tables.
Other DBMSes like TimescaleDB implement a similar feature in a less generic way.
For example, the standard SQL way to write filtered aggregates is:
See https://modern-sql.com/feature/filter
But it is only supported by SQLite, PostgreSQL, and ClickHouse. While ClickHouse also provides a shorthand:
The same for DISTINCT:
Why filtered aggregates are important? - They allow to implement the "segment comparison" feature in web analytics services.
Most of the existing web analytics services are using ClickHouse: CloudFlare Analytics, Microsoft Clarity, Plausible Analytics, PostHog, Splitbee...