ClickHouse materialized views
A materialized view in ClickHouse is an insert trigger, not a stored query. You define it with a SELECT over a source table, but what happens is: every time a batch gets inserted into the source, ClickHouse runs that SELECT over the new batch only and writes the result into a target table (usually a MergeTree variant like SummingMergeTree or AggregatingMergeTree). The result: a continuously-updated pre-aggregation with near-zero read cost. Classic pattern: source table with raw events, MV that groups by (hour, user_id, event_type) summing counts — dashboards query the tiny aggregate table instead of the huge raw one, and stay in sync automatically. The trap: an MV only sees inserts, not updates or deletes to the source (which are rare in ClickHouse anyway). And if your MV aggregation is wrong, you fix it by dropping the target table and rebuilding via POPULATE — expensive, so model carefully up front.