Repository navigation
Run the group_by_dynamic_keys performance queries on 400k rows - #131871
Merged
alexey-milovidov merged 1 commit intoNov 16, 2026
Merged
alexey-milovidov merged 1 commit into
alexey-milovidov merged 1 commit into
Conversation
Queries 0 and 2 of tests/performance/group_by_dynamic_keys.xml take 2.79 / 1.56 s on MasterCI amd (3.51 / 1.90 s on arm); the String control takes 0.13 s. Every row is its own group (the key moduli are pairwise coprime), and 65-86% of CI's CPU samples are in the per-row key serialization of the serialized method (ColumnDynamic::serializeValueIntoArena), which the file measures. No existing query number or text changes: 2 queries are disabled and 2 copies appended as 3 and 4. The copies run the same queries on 400k rows (still one group per row). The JSON fill is read only by the disabled query, so it is renamed and resized in place to t_json_group_by_400k, the first 400k of the same rows. The String control keeps its 2M rows. Local A/B on official builds, two repetitions on different NUMA nodes, L3 capped to one way (decide.py: every gate passes in both): - user time per row of a copy 0.948 (Dynamic casts) and 1.009-1.016 (JSON subcolumns) of its original; - local time ratio copy/original 0.191 and 0.403-0.408 -> projected CI medians 0.53 / 0.63 s amd, 0.67 / 0.78 s arm; - on the MasterCI builds before and after ClickHouse#112316 (7a9ada8 -> 6e89ba5, CI measured 1.26-1.32x on amd, 1.52x on arm), the copies keep 0.836-0.919 of the original's speedup, both seat orders; - on the build of ClickHouse#131331 each copy takes its original's adaptive aggregation path. Below 500k groups a repeated run gets no hash table size hint (HashTablesStatistics getSizeHint at max_threads = 1), so the copies start their table single-level and unallocated where the originals start it two-level and preallocated; that table is about 1% of CI's samples. Saving: about 32 s of query time per master perf job on amd and 40 s on arm; the setup fills 400k JSON rows instead of 1M. Related: ClickHouse#129258 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding), plus my own review (0 blocking findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261115-214201 |
Collaborator
Author
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261115-212700 |
Contributor
|
Workflow [PR], commit [be9219a] Summary: ✅
AI ReviewSummaryPR #131871, reviewed at Missing context / blind spots
Final Verdict✅ Approve |
27 of 39 tasks
alexey-milovidov
approved these changes
Nov 16, 2026
Merged
via the queue into
ClickHouse:master
with commit Nov 16, 2026
1e0344d
384 of 385 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #129258
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Queries 0 and 2 of
group_by_dynamic_keys.xmltake 2.79 and 1.56 s on MasterCI amd (3.51 and 1.90 s on arm); the String control takes 0.13 s. Every row is its own group, and sevenDynamickeys select the serialized aggregation method: 65-86% of CI's CPU samples are inColumnDynamic::serializeValueIntoArena, the cost the file measures.No existing query number or text changes: 2 queries are disabled and 2 copies appended as 3 and 4. The copies run the same queries on 400k rows instead of 2M and 1M, still one group per row. The JSON fill, read only by the disabled query, is renamed and resized in place to its first 400k rows. The String control keeps its 2M rows. Per row, a copy's local user time is 0.95x and 1.01-1.02x its original's.
On the MasterCI builds before and after #112316, which stopped the look-ahead prefetch from serializing every key twice (CI: 1.26-1.32x on amd, 1.52x on arm), the copies keep 84-92% of the originals' speedup locally, in both seat orders and two repetitions on different NUMA nodes. On open #131331's build, the copies take their originals' aggregation path.
Below 500k groups a repeated run gets no hash table size hint, so the copies start their table single-level and unallocated where the originals start it two-level and preallocated; that table is about 1% of CI's samples.
The copies should take 0.53-0.63 s on amd and 0.67-0.78 s on arm: about 32 s of query time per master perf job on amd and 40 s on arm, and the setup fills 400k JSON rows, not 1M. The copies restart the history of 2 queries.
Validation:
perf.pyon the final file runs only queries 1, 3 and 4, also with CI's--max-queries 10, with no run trend.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131871]
Version info
26.11.1.2412-master(included in26.11and later)