Repository navigation
Remove the rewrite-off arms of the like_perfect_affix_rewrite performance test - #125531
Conversation
…ance test With `optimize_rewrite_like_perfect_affix=0`, every row of the fixture matches, so `MatchImpl` calls the dispatched StringZilla `sz_find` once per row, 10M times per query. On amd the cost of that call varies by 5-10% between binaries and between server processes (the red run's extra CPU samples are all in `sz_find_skylake`), so over 30 days the old/new ratio of `#0` crossed 15% in 29 of 1,193 master-vs-master runs and 26 of 1,316 PR runs (median 1.001), and reddened `Performance Comparison (amd_release, master_head, 2/6)` on unrelated ClickHouse#122420 (+20.9%, +17.2% after restart). `ClickHouse#2` behaves the same. The rewrite-on arms never crossed 15% on amd (0 of 2,518, p99 1.109 / 1.081). The harness compares the same query index across builds, never one arm against another, so the `=1` arms are the detector for the rewrite: if it stopped applying they would get 1.6x to 1.7x slower. The rewrite-off LIKE path stays measured by the two `optimize_rewrite_like_perfect_affix = 0` arms of `regexp_anchored_literal.xml` (0 runs above 12% in over 1,050 amd runs each), and correctness by `03594_like_perfect_affix_rewrite_pass`. Same shape as ClickHouse#122156. The survivors renumber to #0/ClickHouse#1, so their learned thresholds reset to the 0.15 floor, which is above their p99. 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 (0 blocker, 0 major, 1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261012-215000 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261012-213700 |
|
Workflow [PR], commit [1f31c81] Summary: ✅
AI ReviewSummaryThis PR removes the two Missing context / blind spots
Final Verdict✅ No blocker or major findings in the current diff. No inline review comments to post. |
Related: #122420
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Test-only change, no changelog entry required.
Description
like_perfect_affix_rewrite #0(LIKE 'prefix%'withoptimize_rewrite_like_perfect_affix=0) failedPerformance Comparison (amd_release, master_head, 2/6)on #122420 as a confirmed regression: 0.1311 s to 0.1586 s (+20.9%), +17.2% after a restart. That PR does not touch this path. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122420&sha=806534a049f136287d382c92f36be70e3d955114&name_0=PR&name_1=Performance%20Comparison%20%28amd_release%2C%20master_head%2C%202%2F6%29Root cause. With the rewrite off, every row of the fixture matches, so
MatchImplcalls the dispatched StringZillasz_findonce per row, 10M times per query. On amd, the cost of that call varies by 5-10% between binaries and between server processes: the red run's extra CPU samples are all insz_find_skylake. Over 30 days on amd, the old/new ratio of#0crossed 15%, in both directions, in 29 of 1,193 master-vs-master runs (for example8a6b5608b0adat 1.157) and in 26 of 1,316 PR runs (median ratio 1.001);#2behaves the same. The rewrite-on arms#1/#3never crossed it on amd (0 of 2,518 runs, p99 ratio 1.109 / 1.081), and on arm the whole test crossed it once in about 7,000 runs.Change. I delete the two
=0arms. The harness compares the same query index across builds, never one arm against another, so the=1arms were always the detector: if the rewrite stopped applying, they would get 1.6x to 1.7x slower. The LIKE path with the rewrite off stays measured inregexp_anchored_literal.xml(its twooptimize_rewrite_like_perfect_affix = 0arms: 0 runs above 12% in over 1,050 amd runs each). Correctness is covered by03594_like_perfect_affix_rewrite_pass. Same shape as #122156.Cost: the survivors renumber to
#0/#1, so their learned thresholds reset to the 0.15 floor, still above their p99.Validated with
perf.pyagainst an official master build: 2 queries, both run, no errors.Workflow [PR]
Sync PR [sync-upstream/pr/125531]
Version info
26.10.1.2299-master(included in26.10and later)