Introducing multi-stage distributed query execution in ClickHouse Cloud
ClickHouse Cloud adds multi-stage distributed query execution, splitting a query plan into stages connected by exchange operators (Gather, Shuffle, Broadcast, Scatter) so intermediate data can be repartitioned between nodes mid-query. Shuffling by join key means each worker builds only its share of the hash table instead of the full right side, and shuffling by GROUP BY key removes the single-coordinator final merge for high-cardinality aggregations. Exchanges stream blocks between workers over TCP by default, with a persisted mode writing to object storage for spilling and future fault recovery. Early TPC-H results show up to 3.4× speedups on join-heavy queries and 7.4× faster aggregation on 8 nodes versus 1.
Related posts
- How we scaled raw GROUP BY to 100 B+ rows in under a second
ClickHouse mediumAdept
ClickHouse Cloud's parallel replicas feature spreads a single GROUP BY query across every core of every node in a service, with no pre-aggregation or data reshuffling. In the benchmark, 100 billion rows were aggregated in 414 ms at about 1.45 TB/s, compared with 16.6 s on a single 89-core node. The speedup rests on ClickHouse's execution model. Each pipeline stream scans a non-overlapping set of part ranges and builds mergeable partial aggregation states in one of 30+ specialized hash table variants, so any core or node can process any subset of rows and the partial results merge correctly. The post also covers memory behaviour by aggregate function, the reproducible benchmark setup, and how runtime scales vertically (more cores per node) and horizontally (more nodes).
- How ClickHouse became fast at joins
ClickHouse hardMaster
ClickHouse became 26× faster on the join-heavy TPC-H SF100 workload between 22.4 and 26.4. In the first year (4.4×) parallel hash join became the default, build and probe phases were optimized and two-table reordering was added. In the second year (another 6× with default settings) four changes landed: decorrelation of correlated subqueries, lazy column replication, runtime filters and statistics-based join reordering. Lazy replication represents repeated join outputs as dictionary indexes instead of copying wide strings (1.9× faster in a self-join benchmark). Runtime bloom/min-max filters built from build-side keys are applied as PREWHERE on the probe side (2.1× faster, peak memory cut from 1.24 GiB to 185 MiB).
- ClickHouse Release 25.9
ClickHouse mediumAdept
ClickHouse 25.9 adds automatic global join reordering, which uses a greedy algorithm plus row-count estimates or manually created column statistics to pick build/probe order across many tables. On a six-table TPC-H query at scale factor 100 it cut runtime from over an hour to 2.7 seconds (~1,450×) with ~25× less memory. Secondary indices are now checked granule by granule while data is read, so LIMIT queries stop early; one LIMIT 1 query ran over 4× faster. Other changes include an experimental streaming-friendly text index replacing the FST design, Iceberg write and metadata improvements, arrayExcept, argument-less boolean settings, and S3 storage class selection.
- ClickHouse vs. Elasticsearch: The Mechanics of Count Aggregations
ClickHouse mediumAdept
ClickHouse runs count(*) GROUP BY aggregations in parallel at three levels: SIMD within column values, multiple cores over arbitrary data ranges, and multiple nodes over shards. Partial aggregation states let the results be merged exactly. Elasticsearch's terms aggregation instead uses one thread per shard and merges shard-local top-n results. That approach gives approximate counts across shards unless shard_size is raised, always requires a size limit, and is capped by max_buckets. For continuous summarization, ClickHouse's -State/-Merge combinators with AggregatingMergeTree and materialized views aggregate incrementally during background merges. Elasticsearch transforms must keep raw data and re-aggregate whole buckets on every checkpoint, so they are not real-time.
- Agentic analytics starts with query-ready data: the write-side cost of Snowflake vs. ClickHouse
ClickHouse mediumAdept
Under continuous ingest, keeping data sorted for chunk-level pruning is a write-side cost that standard query benchmarks ignore. Snowflake writes micro-partitions in arrival order and relies on background clustering to rewrite them and restore locality. ClickHouse sorts each insert by the table's sorting key and preserves that order through linear background merges. Measured while ingesting about 1M rows per second, ClickHouse keeps data query-ready at 22× lower cost with 28× better write-side cost-performance, which matters for agentic workloads that fire bursts of low-latency queries over fresh data.