Repository navigation
Perf CI: fetch the learned thresholds by the key prefix of query_metrics_v2 - #127387
egor-click merged 1 commit into
Conversation
…rics_v2` `GET_HISTORICAL_TRESHOLDS_QUERY` filters `query_metrics_v2` on `event_date`, `metric`, `pr_number` and `workflow_name`, none of which is a prefix of the table key `(new_sha, test, query_index, metric)`. Only partition pruning and the per-part `event_date` min/max can skip data, and merges keep folding new October parts into older ones, so the primary-key estimate for the six-week window grew past the 20B `max_rows_to_read` of the `play` user: 21.11B on 2026-10-20, 22.13B on 2026-10-21, 20.89B on 2026-10-22. On `Code: 158` the job writes an empty `historical-thresholds.tsv`, and every query is judged by the bare floors. Select the same master runs by the key prefix, `new_sha IN (SELECT new_sha FROM perf_test_times_v1 ...)`. The job writes both tables in the same REPORT stage with the same `pr_number`, `new_sha` and `workflow_name`, so the subquery repeats the main query's own filter. Its window is one day wider on each side, because the two uploads of one run can fall on either side of midnight. `perf_test_times_v1` is ordered by `(pr_number, new_sha, ...)`, so the set costs 2.7M rows; `checks` is ordered by `check_start_time` only (a 5.5B-row estimate for the range) and would select the runs by check name. Measured on play on 2026-10-22: 3.23B rows read in about 4 s instead of a 20.89B estimate and `Code: 158`, with the same 9,875,704 aggregated rows from 1338 SHAs. Every one of the 2639 master SHAs with `query_metrics_v2` rows from Aug 1 to Oct 15 is in `perf_test_times_v1`, and on both halves of the current window (09-15..09-30 and 10-01..10-15) the output is byte-identical to the original query's. The `double-check-perf-tests` copy of the query gets the same filter. For a run day before 2026-06-01 its window starts before the first `perf_test_times_v1` row (2026-04-24), so it would see fewer SHAs there; CI itself only uses `today()`. 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). It read both changed queries, their caller Session id: cron:clickhouse-review-slot-10:20261022-112300 |
|
cc @egor-click, could you review this and add the |
|
Workflow [PR], commit [a4c8c7b] Summary: ✅
AI ReviewSummaryThe PR reduces historical-threshold reads by selecting master SHAs through Final VerdictStatus: ✅ Approve |
e0ae5a4
Related: #100759
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required: CI-only change.
Description
Since 2026-10-20 the
Select historical datastep ofPerformance Comparisonfails withCode: 158 ... Limit for rows (controlled by 'max_rows_to_read' setting) exceeded, max rows: 20.00 billion, current rows: 21.11 billion(first failing job; 22.13B on the next day). The job then writes an emptyhistorical-thresholds.tsv, so every query is judged by the bare floors instead of its learned threshold: flagged queries per master commit went from 3.7/3.1 (amd/arm) to 15.1/12.3. It recovered at midnight and broke again on 2026-10-22 (20.89B).query_metrics_v2is ordered by(new_sha, test, query_index, metric), and none of the query's filter columns is a key prefix. Only each part'sevent_daterange can skip data, and merges keep widening it, so the query reads the PR runs of the whole window to aggregate master rows only.The query now also requires
new_sha IN (SELECT new_sha FROM perf_test_times_v1 ...), with the samepr_number = 0 AND workflow_name = 'MasterCI'filter and a window one day wider on each side. The same job writes both tables, andperf_test_times_v1is ordered by(pr_number, new_sha, ...), so the set costs 2.7M rows (checksis ordered by time only, so a set from it would cost a 5.5B-row estimate). Thedouble-check-perf-testscopy of the query gets the same filter.Validated on play through
prepare_historical_data's own CIDB call: before,Code: 158; after, 6534 rows from 3.23B rows read in 4 s. The aggregated rows are the same (9,875,704 from 1338 SHAs; all 2639 master SHAs from Aug 1 to Oct 15 are inperf_test_times_v1), and on both halves of the current window the output is byte-identical to the original query's. The read is also about 6x smaller againstplay's hourlyread_rowsquota, which is shared per client address.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/127387]
Version info
26.11.1.551-master(included in26.11and later)