v.20.4Improvement

Auto distributed_group_by_no_merge on GROUP BY sharding key with optimize_skip_unused_shards enabled

Auto distributed_group_by_no_merge on GROUP BY sharding key (if optimize_skip_unused_shards is set) #10341 (Azat Khuzhin)
Introduced automatic enabling of distributed_group_by_no_merge optimization when performing GROUP BY on the sharding key, provided that optimize_skip_unused_shards is enabled.

Why it matters

This feature improves query performance by allowing ClickHouse to skip merging data from shards unnecessarily during GROUP BY operations on the sharding key, reducing data processing and network overhead when optimize_skip_unused_shards is active.

How to use it

Enable the optimize_skip_unused_shards setting to allow ClickHouse to automatically apply the distributed_group_by_no_merge optimization for GROUP BY queries on the sharding key. This requires no additional user action besides setting optimize_skip_unused_shards=1.