Repository navigation
Make setting count_distinct_optimization obsolete - #129307
Conversation
A single `uniqExact` or `count(DISTINCT)` without `GROUP BY` is now computed by radix partitioning (`optimize_uniq_exact_radix_partitioning`), which covers every argument type and spills to disk, so the rewrite of `countDistinct(x)` into `count()` over a `GROUP BY x` subquery is no longer useful. Remove `CountDistinctPass` and the tests that only checked the rewrite. The tests of other components that were reached through the rewrite now run the rewritten query directly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [37314ff] Summary: ✅
AI ReviewSummaryRemoves Findings
Tests
Missing context / blind spots
Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 21 s compile time in total, 8 of them have a recent master baseline. |
The setting
count_distinct_optimizationrewrotecountDistinct(x)/uniqExact(x)of a query with only aSELECTclause intocount()over aGROUP BY xsubquery. After radix partitioning of a singleuniqExactwithoutGROUP BY(which covers every argument type and spills to disk), the rewrite no longer helps, soCountDistinctPassis removed and the setting is obsolete.The only case it still covered was a table with an aggregate projection
GROUP BY x: the rewritten query read the projection, whileuniqExact(x)withoutGROUP BYreads the table. Supporting it would need aggregation of raw key values in the merge-only aggregation over a projection, which we decided not to add for such a corner case.Tests that only checked the rewrite are removed; tests of other components that were reached through the rewrite (
04066,04605) now run the rewritten query directly.Related: #123552
Related: #127252
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Setting
count_distinct_optimizationis obsolete and has no effect. It rewrotecount(DISTINCT x)intocount()over aGROUP BY xsubquery, which is no longer faster than the radix partitioneduniqExactused forcount(DISTINCT x)withoutGROUP BY(optimize_uniq_exact_radix_partitioning).Workflow [PR]
Sync PR [sync-upstream/pr/129307]
Version info
26.11.1.1760-master(included in26.11and later)