An Aggregate Is a Function, Not a Sum
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
Alexander Novikov describes how his team built sales-receipt reports on ClickHouse after four designs failed on duplicates, late documents and outages. The design that held treats an aggregate as a function of its documents: hourly per-register cells are recomputed from a narrow table when marked dirty, then versioned and replaced. On a small two-shard test cluster, the 600-shift report fell from 23.4 s to 2.1 s. The figures are the author's own and unsourced, and replica recomputation is an acknowledged gap, untested because the cluster had one replica per shard.