Repository navigation
Stabilize the wide-string greatest query of the least_greatest_const_columns performance test - #122784
Conversation
…columns performance test `least_greatest_const_columns ClickHouse#2` returns the 256-byte constant `repeat('d', 256)` for every row, so the result `ColumnString` grows its `chars` by power-of-two `realloc` up to 16 MiB per block. Whether jemalloc grows that buffer in place or moves and copies it (`large_ralloc` -> `memcpy`) differs between server processes, and in CI CPU profiles that copy is the only part of the query whose sample count differs between the two servers. In 14 days the two servers differed by more than 15% in 94 of 775 amd and 23 of 1692 arm runs of this query, and in none for `ClickHouse#3`, which takes the same arguments with `least` and returns the ~7-byte `toString(number)`. Add a constant `'e'` that wins every row, so the result is one byte per row. The query still compares `toString(number)` against the four 256-byte constants that are not materialized since ClickHouse#119108, and still returns a constant argument. Failing job: https://github.com/ClickHouse/ClickHouse/actions/runs/36432228454/job/109047348805 PR: ClickHouse#122184 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review of this head by an independent model (engine: codex) and my own cold review: 0 findings, nothing to adjudicate. Session id: cron:clickhouse-review-slot-10:20260928-234300 |
|
Workflow [PR], commit [c816b4e] Summary: ✅
AI ReviewSummaryThis PR changes Final VerdictStatus: ✅ Approve |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20260928-231200 |
Related: #119108
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required: CI-only change.
Description
least_greatest_const_columns #2(greatestoftoString(number)and four 256-byte constants) was the only failed query of arm 4/6 on #122184: 0.2203 -> 0.2630 s,confirmed_regression. It reads no table, so that PR cannot reach it.Runs where the two servers differ by more than 15% (14 days to 2026-09-28):
#2#3greatestreturnsrepeat('d', 256)for every row, socharsgrows byreallocto 16 MiB per block, and jemalloc moves and copies it whenever it cannot grow it in place. In four CI CPU profiles, samples outside that copy match between the servers within about 3%, while thelarge_ralloc -> memcpysamples (5/55, 24/118, 26/124, 87/52) are always higher on the slower server.#3(least) returns the ~7-bytetoString(number).I added a constant
'e'that wins every row, so the result is one byte per row. The query still compares against the four 256-byte constants that #119108 stopped materializing, and still returns a constant argument.Local check (x86, official master build, pinned like CI amd):
large_ralloc: 42.7% before, 0.8% after, all in thetoString(number)input that#3shares.#3. Between servers all stayed within 9%: this machine does not reproduce the CI draws.materializeon the constants (the pre-Perf: avoid materializing constant arguments in least and greatest #119108 path) makes the new query 3.96x slower (old: 2.88x).🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/122784]
Version info
26.10.1.982-master(included in26.10and later)