Skip to content

Run the constant_column_search queries above 1 s on hits_10m_single - #132300

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/perf-constant-column-search-10m
Nov 18, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/perf-constant-column-search-10m

Conversation

@groeneai

@groeneai groeneai commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #129258

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):

...

Description

Seven queries of constant_column_search.xml (numbered from 0, as in the report: 4, 7, 11, 15, 18 and 21 with multiMatchAny, 17 with multiSearchFirstIndex) scan all 100M URL values of hits_100m_single and take 1.16-1.52 s on MasterCI amd and 0.70-1.04 s on arm. For multiMatchAny the vectorscan database is compiled once and every measured run hits its cache, so the time is the per-row scan.

No existing query number or text changes: 7 queries are disabled and the same 7 appended on hits_10m_single as 28-34, as #131677 did for adaptive_aggregation_top_k_threshold. This file already runs its other match, multiMatchAny and multiSearchAny variants on that table.

Measured on official MasterCI release builds: per row the copies take 0.98-1.05 of the originals' user time. Across the vectorscan 5.4.13 update of #125774, which slowed queries 4, 7, 11, 15 and 18 by 4-25% locally (4-19% on CI), their copies slow down by 3-28%; queries 17 and 21 stay flat in both. Under perf.py the copies take 0.106-0.113 of the originals' time, about 0.13-0.17 s on amd and 0.08-0.11 s on arm: about 37 s (amd) and 24 s (arm) less query time per master perf job.

On the final file perf.py runs none of the disabled queries, also with --max-queries 10. 28 queries stay enabled, so each keeps its chance to be selected. The 7 copies start a new history.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.2765-master (included in 26.11 and later)

No existing query number or text changes: 7 queries are disabled and the
same 7 appended on `hits_10m_single` as 28-34.

Queries 4, 7, 11, 15, 18, 21 (`multiMatchAny`) and 17
(`multiSearchFirstIndex`) scan all 100M `URL` values of `hits_100m_single`
and take 1.16-1.52 s on MasterCI amd, 0.70-1.04 s on arm. The `vectorscan`
database is compiled once and cached (0 global cache misses per measured
run), so the time is the per-row scan. Each copy is the original with
`hits_100m_single` -> `hits_10m_single` and nothing else; the file already
runs its other `match`, `multiMatchAny` and `multiSearchAny` variants on
that table.

Probe on official MasterCI amd release builds (clickhouse local, 8 pinned
cores): per-row user time copy x 10 / original 0.978-1.053 on e191b1a,
324e8a3 and fc8a493. On the ClickHouse#125774 merge (vectorscan 5.4.11 -> 5.4.13,
e191b1a -> 324e8a3) the originals 4, 7, 11, 15, 18 move by
1.190, 1.211, 1.042, 1.249, 1.072 and their copies by 1.219, 1.241, 1.030,
1.280, 1.112 (retention 0.70-1.52); 17 and 21 stay flat in both.

perf.py, two fc8a493 servers, 12 runs: copy / original 0.106-0.113, about
0.13-0.17 s projected on CI amd and 0.08-0.11 s on arm; per-row user time
0.99-1.03. On the final file perf.py measures the 28 enabled queries and
none of the 7 disabled ones, also with --max-queries 10. Projected saving:
about 37 s (amd) and 24 s (arm) of query time per master perf job.

Related: ClickHouse#129258

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) plus my own review of the same head (0 blockers, 0 majors, 1 nit, not blocking).

# Sev Finding Verdict Evidence / action
1 💡 The vectorscan 5.4.13 update moves query 11 by only 4% and queries 17 and 21 not at all, so copies 30, 32 and 34 rest on equal per-row work AGREE, noted Per row the copies take 0.98-1.05 of the originals' user time on 3 builds and 0.99-1.03 under perf.py; no other build pair moved these queries on CI

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-8:20261117-084600

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes: perf.py on official master builds (8 pinned cores, max_threads 8) runs the 7 originals at 1.23-1.67 s, 1.05-1.10x their MasterCI amd medians, on every run.
b Root cause explained? Input size: each query scans all 100M URL values of hits_100m_single at about 100 ns of user time per row. The vectorscan database is compiled once and cached (0 cache misses on every measured run), so the time scales with the rows.
c Fix matches root cause? Yes: the copies read 10M rows of the same column with the same functions and needles. No threshold, tag, setting or harness change.
d Test intent preserved / new tests added? Yes: per row the copies take 0.98-1.05 of the originals' user time (3 builds, and under perf.py). Across the vectorscan 5.4.13 update of #125774 the originals 4, 7, 11, 15, 18 slow down by 4-25% and their copies by 3-28%; 17 and 21 are flat in both. New: queries 28-34.
e Both directions demonstrated? Yes: on the build pair the copies show the slowdown and add none where the originals have none; each gate refused a corrupted copy of its input; on the final file perf.py runs the 28 enabled queries and never the 7 disabled ones, also with --max-queries 10.
f Fix is general across code paths? Every query of the file above 1 s is handled; the other 21 take 0.14-0.94 s.
g Fix generalizes across inputs (params/datatypes/wrappers)? Same needles and patterns. The 10M sample has lower hit rates (9.5% vs 15.1%, 0.97% vs 7.98% for 25 patterns) at the same per-row work; results checked exactly on every build.
h Backward compatible? (maintainer-approved exception only) Yes: queries 0-27 keep their number and text, so their history continues; 28-34 are new. No setting change.
i Invariants and contracts preserved? Nothing deleted or reordered (disabled only), copies appended after the last query, no create/fill, no perf.py change. 28 queries enabled before and after, so the --max-queries 10 selection chance per query is unchanged.

Session id: cron:clickhouse-impl-slot-5:20261117-082001

@clickhouse-gh

clickhouse-gh Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3d88793]

Summary: ✅


AI Review

Summary

PR #132300 shortens seven constant_column_search benchmarks by disabling their 100M-row versions and appending equivalent queries on hits_10m_single. Existing query texts and indexes are preserved, with 28 queries remaining enabled. No actionable findings. The recorded runtime and historical regression measurements support the smaller workload; benchmarks were not rerun locally.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 17, 2026
@clickhouse-gh clickhouse-gh Bot added can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). labels Nov 17, 2026
@Algunenano Algunenano self-assigned this Nov 18, 2026
@Algunenano

Copy link
Copy Markdown
Member

@groeneai I'm curious, why is ARM much better than AMD in this case? Machine size? Different (more optimal) code?

@Algunenano
Algunenano added this pull request to the merge queue Nov 18, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

The thread count, not the code. Both runners have 16 vCPUs, but the amd one (m7i.4xlarge) has 8 physical cores with 2 hyperthreads each, and the job pins both servers to one hyperthread per core with max_threads = 8 (write_max_threads_override in ci/jobs/performance_tests.py). The arm one (m8g.4xlarge) has 16 cores and keeps the static max_threads = 12 from tests/performance/scripts/config/users.d/perf-comparison-tweaks-users.xml.

The CPU work is about the same: on MasterCI since 2026-11-13 (default.query_metrics_v2, 77-98 commits per query), these 7 queries take 8.5-11.4 s of user time on amd and 7.5-11.9 s on arm (arm +2-10% for the multiMatchAny ones, -12% for multiSearchFirstIndex). But amd spends about 7.4 s of user time per second of wall time and arm about 11.3, so the 12 threads give arm its 1.4-1.65x shorter wall time.

Merged via the queue into ClickHouse:master with commit f9e17d6 Nov 18, 2026
571 of 573 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 18, 2026
@clickhouse-gh clickhouse-gh Bot added comp-regular-function Regular scalar functions: string processing, data conversion, arithmetic, math, comparison, condi... 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-regular-function Regular scalar functions: string processing, data conversion, arithmetic, math, comparison, condi... 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.

3 participants