Repository navigation
Run two kway_merge_expensive_comparator sorts on a quarter of the rows - #131660
Conversation
The collation sort (ClickHouse#2, 5M rows) and the single-column string sort (ClickHouse#3, 20M rows) take 1.2-1.9 s on MasterCI on both arches. They get disabled="1" (text and number unchanged) and are appended as ClickHouse#9 and ClickHouse#10 on a quarter of the rows with max_block_size = 16384, a quarter of the default 65409. `numbers_mt` hands out blocks of exactly max_block_size rows, so each copy has as many blocks as its original (77 and 306): the same number of cursors in every per-stream merge and the same 16-stream final merge, with a quarter of the rows per block. EXPLAIN PIPELINE of each original and its copy is identical (16 streams). Measured on official MasterCI release builds, two servers pinned to 24 cores of one NUMA node, perf.py, 25 runs: copy / original time 0.248 (ClickHouse#2) and 0.252 (ClickHouse#3), projected CI medians 380 / 487 ms amd, 298 / 483 ms arm. On the builds before/after ClickHouse#115869 (sorted array of cursors) ClickHouse#2 is 1.161x faster and its copy 1.159x; on those before/after ClickHouse#126829 (cheaper collation) 2.179x and 2.111x; ClickHouse#3 and its copy show no change on either pair (1.005 / 1.008, 1.004 / 1.001), as the heap guard should. #0 and ClickHouse#1 stay as they are: on this rig the ClickHouse#115869 change did not show on them beyond the A/A resolution, so there was no measured guarantee that copies would keep their sensitivity. About 32 s (amd) and 29 s (arm) of query time less per master performance job; 9 queries stay enabled, so all of them still run. Related: ClickHouse#129258 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261114-161900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261114-141505 |
|
Workflow [PR], commit [80d078c] Summary: ✅
AI ReviewSummaryReviewed #131660 at Final VerdictStatus: ✅ Approve. |
e7c09ad
Related: #129258
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
From the #129258 audit: four full sorts of
kway_merge_expensive_comparator.xmltake more than 1 s on MasterCI since 2026-11-10. This PR shortens two of them: the collation sort (query 2, 5M rows: 1533 ms amd, 1202 ms arm) and the single-column string sort (query 3, 20M rows: 1932 / 1916 ms).No existing query number or text changes: 2 queries are disabled and 2 are appended. Queries 2 and 3 get
disabled="1"and are appended as 9 and 10 withnumbers_mt(N / 4)andSETTINGS max_block_size = 16384, a quarter of the default 65409.numbers_mtreturns blocks of exactlymax_block_sizerows, so each copy has as many blocks as its original (77 and 306): every per-stream merge keeps its number of cursors and the final merge stays 16-way.EXPLAIN PIPELINEof each original and its copy is identical.Measured with
perf.pyon official MasterCI release builds (25 runs per pass): each copy takes 0.25 of its original's time, so about 380 / 487 ms on amd and 298 / 483 ms on arm, and about 32 s (amd) and 29 s (arm) less query time per master perf job. On the builds before and after #115869 (sorted array of cursors), query 2 is 1.161x faster and its copy 1.159x; before and after #126829 (cheaper collation), 2.179x and 2.111x. Query 3 and its copy show no change on either pair.Queries 0 and 1 stay as they are: locally #115869 did not show on them beyond the A/A noise, so I have no measurement that shorter copies would keep their sensitivity.
Queries 9 and 10 start a new history (CIDB has only 0-8 for this test). 9 queries stay enabled, so every master job still runs all of them.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131660]
Version info
26.11.1.2370-master(included in26.11and later)