Performance· Case study 06
ClickHouse performance & cost re-architecture with projections
Re-architected a high-volume ClickHouse analytics workload around tiered projections, directory-based partitions, and tuned compression, which stopped out-of-memory dashboard failures and cut storage and compute.
0
dashboard out-of-memory failures after rollout
Architecture at a glance
- query_log profile
- Tiered projections
- Partitions + ZSTD + TTL
- Fast dashboards
01 The problem
Interactive dashboards over a very large event table were failing with memory-limit errors, and storage kept growing faster than the value it delivered.
02 What I built
- 1Profiled query logs to find which dimension and measure combinations dashboards actually used.
- 2Designed tiered projections that pre-aggregate each dashboard tier, including every primitive aggregate the metrics layer needs, so queries hit small projections instead of raw data.
- 3Capped the projections’ storage footprint and set deduplicate-merge-projection behavior so merges stay correct.
- 4Moved to directory-based partitions, set TTLs on non-lookup tables, dropped unused high-cardinality columns such as session IDs, and tuned ZSTD compression levels.
- 5Set query memory and concurrency limits and disabled unnecessary refreshes during the backfill.
03 Impact
Dashboard memory failures stopped and queries moved onto small pre-aggregated projections. This work is part of the ~30–40% storage and CPU reduction delivered for enterprise customers.
Related case studies
- PlatformSelf-hosted ClickHouse platform on Kubernetes14 production ClickHouse clusters
- AIAI-assisted ClickHouse optimization with MCPMulti-TB single columns found in one audit pass
- MigrationWarehouse & lakehouse to ClickHouse, with reverse ETL and integrity checksEvery hop reconciled for drift, hourly