Skip to content

Remove the disabled-optimization baseline arms from the preimage performance test - #122156

Merged
fm4v merged 5 commits into
ClickHouse:masterfrom
groeneai:groeneai/preimage-perf-drop-baseline-arms
Sep 30, 2026
Merged

fm4v merged 5 commits into
ClickHouse:masterfrom
groeneai:groeneai/preimage-perf-drop-baseline-arms

Conversation

@groeneai

@groeneai groeneai commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #101039

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Test-only change, no changelog entry required.

Description

Requested by @ alexey-milovidov on #101039: optimize_time_filter_with_preimage #4 reported slower.

Failing job: https://github.com/ClickHouse/ClickHouse/actions/runs/35802337557/job/107121827880
Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=101039&sha=8112f66ad1a46b94d0af1a745b26caae83eac90a&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%201%2F6%29
#4 went 0.5476 s to 0.682 s (+24.5%), the only row that failed the shard. It also reds trunk with no pull request involved, for example on master: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=fbb92cbacecdd22ddcfc8cf8553be549642da2e9&name_0=MasterCI&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%203%2F6%29

Root cause. Three of the seven timed queries carry optimize_time_filter_with_preimage = 0, opting out of the optimization under test. Disabled, each is a single-threaded scan of 25M to 50M rows (arm p50 384/560/446 ms against 78/76/142/83 ms for the other four), 79% of the test's runtime. Long single-threaded scans swing widely on arm runners: over 30 days on Performance Comparison (arm_release, *) they hold 339 of this test's 356 slower verdicts, 259 of 260 unstable, and all 21 on true master, where both sides run identical code. #4 alone gave 91, over 80 pull requests.

Change. I delete those three arms. Detection is unaffected: the harness compares the same query index between the old and the new build, never one arm against another, so the = 1 arms were always the detector; if the rewrite stopped applying they would move 3.9x to 5.4x against p99 ratio ceilings of 1.040 to 1.173. I change the arm rather than the tiering that classified it: that threshold is not in this repository.

Paired = 0 / = 1 arms appear in 28 of 673 perf tests; this is not a sweep, these three are just the file's slowest by 5x.

Cost: the survivors renumber, so three of the four fall back to the in-tree 0.15 threshold until history rebuilds; their p99 ratios are 1.181, 1.040 and 1.049. #0 and the range query have each since been tiered once near +18%, at 76 to 78 ms where timer granularity dominates.

Related: #121456 tracks sibling instances of this class.


Workflow [PR]
Sync PR [sync-upstream/pr/122156]

Version info

  • Merged into: 26.10.1.1078-master (included in 26.10 and later)

…ormance test

The three `optimize_time_filter_with_preimage = 0` arms run the query with the
optimization under test disabled, which makes each a single-threaded full scan of
a 50M-row table (arm p50 384/560/446 ms against 78/76/142/83 ms for the other
four). Over 30 days on `Performance Comparison (arm_release, *)` they produced 339
of the test's 356 `slower` verdicts, 259 of 260 `unstable` verdicts and all 21
verdicts on true master, where both sides run identical code. One of them, `ClickHouse#4`,
is tiered `confirmed_regression` by the dashboard and fails the shard on unrelated
pull requests.

Detection is unaffected: the harness compares the same query index between the old
and the new build, never one arm against another, so the `= 1` arms were always the
detector. If the rewrite stopped applying they would move by 3.9x to 5.4x against
measured p99 ratio ceilings of 1.040 to 1.173.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 25, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: no blocking findings

Two independent reviews of this diff (a cold code review and a separate second-model gate) found
no blocker and no major. The gate returned zero findings.

⚠️ Two nits, neither blocking:

  • The commit message describes each deleted arm as "a single-threaded full scan of a 50M-row
    table". Two of the three are; the fixture holds exactly two distinct days of 25M rows each, so
    toDate(seen) = toDate('2026-03-02') matches half the table rather than all of it. The PR body
    says "25M to 50M rows". Every quoted timing is unaffected.
  • The slower and unstable counts come from a rolling 30-day window, so they move. Re-measured
    about half an hour after the body was written: slower 339 of 356 on the three deleted arms and
    21 of 21 on true master were both unchanged; unstable had moved from 259 of 260 to 260 of 261,
    and the per-arm p50s by 2 to 3%. The detector margins measured 4.0x to 5.5x against the 3.9x to
    5.4x the body claims, so the body is the conservative side.

💡 The two-sided spread is the part I would look at first if the "reported slower" verdicts look
like a real regression: at the 1st percentile the three deleted arms run 31% to 45% faster
(ratios 0.550, 0.685, 0.644), which is not a shape a regression can produce.

@clickhouse-gh

clickhouse-gh Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2dffc88]

Summary: ✅


AI Review

Summary

This PR removes the three optimize_time_filter_with_preimage = 0 baseline queries from tests/performance/optimize_time_filter_with_preimage.xml so the perf test stops spending most of its time on the known-noisy full-scan arms. I found no blocker or major in the current diff: the remaining queries still cover the optimized paths, and the perf harness matches learned thresholds on both query_index and query_display_name, so the renumbered survivors fall back to fresh/default thresholds instead of inheriting history from the deleted arms.

Missing context / blind spots
  • ⚠️ The current PR does not have pr-performance, so its perf-comparison shards were skipped. I validated the harness behavior and the XML change itself, but I did not independently re-measure the claimed 30-day instability statistics from a fresh CI run in this environment.
Final Verdict

✅ No review findings.

@fm4v
fm4v added this pull request to the merge queue Sep 30, 2026
Merged via the queue into ClickHouse:master with commit 0927110 Sep 30, 2026
149 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 30, 2026
valerypetrov pushed a commit to valerypetrov/ClickHouse that referenced this pull request Oct 13, 2026
…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]>
@clickhouse-gh clickhouse-gh Bot added comp-query-analyzer Semantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-query-analyzer Semantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants