Repository navigation
Run the insert_values_with_expressions performance query above 1 s on the first 10000 rows - #131933
Conversation
… the first 10000 rows No existing query number or text changes: 1 query is disabled and 1 copy appended as query 2. Query 0 reads the 100000-row CI file test_all_expr_matches.values and takes 3.47 s on MasterCI amd and 3.89 s on arm. Every row calls replaceRegexpAll with its pattern as a literal; the Values template turns that literal into a column, so the non-constant pattern is compiled once per row (92% of the query). The copy is the same query with `limit 10000`. With no WHERE, ORDER BY or GROUP BY the planner's trivial-LIMIT path reads one block of 10000 rows and the file source stops there (SelectedRows 10000, FunctionExecute 24). Local perf.py A/B on the official master build fdc4389, two repetitions on different NUMA nodes, also with the L3 capped to one 30 MiB way: - per-row client time of the copy 0.94-0.97 of the original's, user time 0.93-0.96; - replaceRegexpAll's share 0.92 of the original vs 0.90-0.91 of the copy; - the whole file in 10000-row blocks costs 0.996-1.004 of default blocks; - ClickHouse#109239's static build, the one pair that moved query 0 on CI (x1.05 amd), moves it by 0.7-1.4% here and the copy by 0.9-1.3%. Projected CI medians of the copy: 0.33 s amd, 0.37 s arm; about 31 s less query time per master perf job on amd and 35 s on arm. The copy restarts the history of query 0. 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 review (0 blocking findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261116-081900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261116-070700 |
|
Workflow [PR], commit [b575fb3] Summary: ✅
AI ReviewSummaryThis PR shortens the Final VerdictStatus: ✅ Approve |
68d5b2e
Related: #129258
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Query 0 of
insert_values_with_expressions.xmltakes 3.47 s on MasterCI amd and 3.89 s on arm. Every row of its 100000-row file callsreplaceRegexpAllwith its pattern as a literal; the Values template turns that literal into a column, and a non-constant pattern is compiled once per row: 92% of the query. A cache of the compiled patterns was proposed in #122850 and closed as optimizing a corner case.No existing query number or text changes: 1 query is disabled and 1 copy appended as query 2. The copy is the same query with
limit 10000: the reader parses the first 10000 rows as one block and stops. The original withmax_block_size = 10000costs the same (0.996-1.004), so the smaller block is not a regime change. Locally the copy's per-row time is 0.94-0.97 of the original's, and it spends 90-91% of its time inreplaceRegexpAllvs 92% for the original. Both hold in two repetitions on different NUMA nodes, also with the L3 capped to 30 MiB; CI's VMs share 105 MB on amd and 36 MB on arm.The one build pair that moved this query on CI, #109239's static build (x1.05 on amd), moves it by only 0.7-1.4% here and the copy by 0.9-1.3%.
The copy should take about 0.33 s on amd and 0.37 s on arm: about 31 s less query time per master perf job on amd and 35 s on arm. The copy restarts the history of query 0.
Validation:
perf.pyon the final file runs only queries 1 and 2, also with CI's--max-queries 10, with no run trend.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131933]
Version info
26.11.1.2436-master(included in26.11and later)