Skip to content

Performance comparison: audit of the recent growth of the master_head jobs (long queries, duplicates, amd vs arm) #129258

Open

Description

@groeneai

The audit asked for in #129176. Numbers are per master commit (one run of the six amd and six arm master_head shards), from the raw per-test logs (logs.tar.zst) of fa87701 and 4f752f7 (2026-11-04) and from CIDB default.checks.

Where the time goes

Sum over the six shards of each architecture, 844 tests, in minutes:

amd arm
measured query runs 203-206 187-188
prewarm runs 57-58 47
profiling of changed queries 20-22 10-14
result digest and other run-stage time 50-52 50-51
create/fill, sync, drop 85 88
benchmark phase 424-433 391-396

Each shard also pays about 21 min of setup (Select historical data 5, Populate 14) and 3.5-6 min after the tests. 465 of the 844 files existed on 2026-06-01; 379 were added since (June 42, July 53, August 64, September 124, October 95), and they take 176 of the 428 amd minutes.

1. Result digest (#128261, merged 2026-11-03 01:17 UTC)

Every FORMAT Null query now runs once more per server as SELECT count(), sum(cityHash64(toString(tuple(...)))) FROM (<query>). Run-stage time outside the measured runs, prewarm and profiling was 7.5 min (amd) and 9.8 min (arm) per commit on febcc95 (2026-11-02), and 50-52 min on each of the three commits I checked after the merge. It sits in the queries with huge results: bfloat16 +257 s, unary_logical_functions +190 s, hash_join_with_row_store +164 s, sparse_grams +108 s; 37 of the 50 minutes are in tests with a digested result above 200,000 rows, the size at which the client-side digest already gives up. amd shard duration went from p50 92.4 / p90 101.5 min (24 h before, 0 timeouts in 336 runs) to p50 99.7 / p90 112.9 (13 timeouts in 508 runs since); arm from 83.1 / 91.2 to 88.8 / 103.5.

2. Long queries

268-276 queries per amd run have a median above 1 s. With prewarm and 5-7 runs on two servers they cost 96-99 min, 23% of the benchmark. 137 files have at least one; the 20 most expensive files carry 44 min. The top ones (amd minutes per run in those queries):

test min PR
sparse_grams + sparse_grams_index_build 7.0 #78176, #110541
window_functions_* (5 files) 6.0 #122542
prefetch_in_aggregation 3.3 #39304
hash_join_with_row_store + join_lazy_indexing 5.1 #104884, #98883
adaptive_aggregation_heavy_payload 3.1 #115755
ascii 2.9 #61632
threshold_top_k_merge 2.0 #116101
bfloat16 1.8 (+4.3 min of digest) #77449

3. Duplicated queries

5 queries repeat verbatim inside their own file: agg_functions_argmin_argmax #1/#5, avg_weighted #5/#6, hash_table_sizes_stats #2/#4 and #3/#5, joins_in_memory #25/#26. 197 query texts occur in more than one file, but almost all are TPC-H queries in files that differ by settings or table engine (tpch, tpch-join_algorithm-partial_merge, the iceberg_suite_*_tpch files), so not the same path. Note for the same-path duplicates: 155 files have more than 10 queries and no run_all_queries, and the master_head job runs a random 10 of them per test (--max-queries 10), so removing duplicates there does not save time, it only lets the other queries run more often. I will look for same-type, same-length duplicates file by file in the PRs below.

4. Duplicated files

The 16 iceberg_suite_* files (#119147, #119976) take 14.4 amd minutes per run; the TPC-H part repeats tpch.xml on Iceberg, which the Iceberg configuration of #128261 now does nightly and in pull requests that change Iceberg code. @arsenmuk, are they still needed in every master commit, or is the nightly Iceberg configuration enough?

Other families share a fill only partly (polymorphic_parts_{s,m,l}, qbit_l2_distance_*), so merging them saves little; I will merge them where a PR above touches the same files.

5. amd vs arm

Same tests, same setup, different hosts. amd runs on m7i.4xlarge (8 physical cores, 16 hyperthreads; both servers pinned to the 8 cores with max_threads = 8), arm on m8g.4xlarge (16 cores, max_threads = 12). Single-threaded queries take the same time on both (amd/arm median 0.96 over 653 queries), multi-threaded ones are 13% slower on amd (median 1.13 over 2189). amd also profiles about twice as many queries as changed (116-125 vs 57-76 per commit, 10 s each), and the log export and report take about 2 min more per shard. Over all queries above 50 ms, amd/arm was 1.10-1.15 per day in the week before the pinning (f694e80, July) and is 1.12-1.14 now, so the pinning is not the cause. So an amd shard runs about 10 min longer than an arm shard with the same tests and crosses 120 min first.

PRs, one per item

Then the next files of the long-query list, in order of cost.

Activity

  1. Algunenano commented on Nov 4, 2026

    @Algunenano
    Member

    @groeneai Start by removing duplicated queries and or merge those files together. For tcph and similar prefer keeping those files.

  2. added
    comp-ci-infrastructure
    on Nov 4, 2026
  3. groeneai commented on Nov 4, 2026

    @groeneai
    CollaboratorAuthor

    Acknowledged. I'll keep tpch*, tpcds* and the iceberg_suite_* files as they are, and do the rest in this order, one PR each:

    1. The 5 in-file duplicates from section 3 (in progress).
    2. qbit_l2_distance_{bfloat16,float32,float64}_memory: three copies that differ only in the element type and its precisions, merged into one file.
    3. polymorphic_parts_{s,m,l}: same tables and fill, they differ only in the insert block size, row counts and async_insert, merged into one file.
    4. Cross-file repeats outside those suites (30 query texts on today's master): 15 of the 16 date_time_short queries are also in date_time_long, and 15 single queries are shared by 11 other file pairs. For each I'll check whether the settings or the table definition make it a different path, and remove the copy where they don't.

    I'll post each PR link here.

  4. groeneai commented on Nov 4, 2026

    @groeneai
    CollaboratorAuthor

    Item 4: #129303. It deletes date_time_short (15 of its 16 queries are in date_time_long, the 16th moves there) and removes 10 more copies from 8 file pairs. Three pairs are different paths and stay:

  5. groeneai commented on Nov 4, 2026

    @groeneai
    CollaboratorAuthor

    Item 2: #129364. It merges qbit_l2_distance_{bfloat16,float32,float64}_memory into one qbit_l2_distance_memory file with the same six queries on the same tables and data (byte-identical after the tab_<Type> to tab_<bits> rename). The perf history is keyed by test name, so the merged test starts at the default thresholds.

  6. groeneai commented on Nov 4, 2026

    @groeneai
    CollaboratorAuthor

    Item 1: #129366. It removes the later copy of each of the 5 in-file duplicates from section 3. Every one was a <query> element written twice; the hash_table_sizes_stats repeat is not a warmed-statistics run, since both copies share one statistics cache entry. The 23 queries after a removed copy move up one index.

  7. groeneai commented on Nov 4, 2026

    @groeneai
    CollaboratorAuthor

    The rest of this series is on hold: @ egor-click asked to stop it until his coverage-based perf runs experiment has results (#129366 (comment)). #129279 and #129303 are merged, #129364 and #129366 stay open, and I won't open the remaining items until he says to resume.

  8. Algunenano commented on Nov 5, 2026

    @Algunenano
    Member

    This is not finished. The performance tests are in awful shape (it's way better than before, but it's still really bad) so we must continue

  9. groeneai commented on Nov 5, 2026

    @groeneai
    CollaboratorAuthor

    Resuming. #129364 and #129366 are open again and CI has started on both. The remaining items above follow as one PR each (the polymorphic_parts_{s,m,l} merge, then the four shrink items), then the next files of the long-query list in order of cost. I'll post each PR here and ping you on it.

  10. 47 remaining items

  11. groeneai commented on Nov 17, 2026

    @groeneai
    CollaboratorAuthor

    text_index_build_tokenizers is on hold. Its three INSERT queries take 1.06-1.12 s on amd and 1.01-1.09 s on arm, each writing one part of 500000 rows on one thread. #131868 appends three more INSERTs on the same fill to this file: any change here, even the three disabled markers alone, conflicts with it, and appended copies would take the query numbers of its new queries. I will re-measure the file once #131868 is merged or closed and handle all its queries in one PR.

    Next: generate_random_json (its JSON(max_dynamic_paths = 4) and Dynamic queries take 1.30 s and 1.98 s on amd, 0.95 s and 1.44 s on arm).

  12. groeneai commented on Nov 17, 2026

    @groeneai
    CollaboratorAuthor

    Next item: #132277, generate_random_json. Its JSON(max_dynamic_paths = 4) query (3M rows) and Dynamic query (300M rows) take 1.30 s and 1.99 s on amd and 0.95 s and 1.44 s on arm, all of it generateRandom work. The PR disables both and appends them with LIMIT 1500000 and LIMIT 100000000: the same seeds, schema and block size, so each stream generates fewer of the same blocks. No existing query number or text changes. On two official master builds 7 weeks apart the copies take 0.98-1.00 of their originals' user time per row, and the JSON(max_dynamic_paths = 4) copy keeps 0.95-0.99 of its original's growth in per-row CPU from 1 to 8 threads, the shared reference counter contention that the open #122464 removes. That is about 24 s less query time per master perf job on amd and 17 s on arm.

    Next: constant_column_search (seven of its 28 queries take 1.16-1.52 s on amd; on arm one, 1.04 s).

  13. groeneai commented on Nov 17, 2026

    @groeneai
    CollaboratorAuthor

    Next item: #132300, constant_column_search. Seven of its 28 queries (six multiMatchAny and one multiSearchFirstIndex) scan all 100M URL values of hits_100m_single and take 1.16-1.52 s on amd and 0.70-1.04 s on arm. The vectorscan database is compiled once and cached, so the time is the per-row scan. The PR disables the seven and appends the same queries on hits_10m_single as 28-34, the table this file already uses for its other match, multiMatchAny and multiSearchAny variants. No existing query number or text changes. Per row the copies take 0.98-1.05 of their originals' user time, and across the vectorscan 5.4.13 update of #125774, which slowed queries 4, 7, 11, 15 and 18 by 4-25%, their copies slow down by 3-28% (17 and 21 stay flat in both). That is about 37 s less query time per master perf job on amd and 24 s on arm.

    Next: formats_columns_nullable (20 of its 88 queries take 1.00-2.51 s on amd and 1.09-2.90 s on arm, all of them Avro and JSONEachRow expansions).

  14. groeneai commented on Nov 17, 2026

    @groeneai
    CollaboratorAuthor

    Next item: #132357, formats_columns_nullable. Its 20 queries above 1 s are all JSONEachRow and Avro expansions (1.00-2.51 s on amd, 1.09-2.90 s on arm): each reads all 2M rows of its File table, Avro on one thread, JSONEachRow from a 1 GB file. A disabled marker covers all eight formats of a query, so the PR disables the 11 queries and appends them as 88-175: the 66 sub-second expansions verbatim, and the 22 JSONEachRow and Avro ones on new tables of a quarter of the rows (id < 250000), still read whole with default parallel parsing as #123691 set up. No existing query number or text changes. Per row the copies take 0.98-1.04 of their originals' user time, and across #119039, which moved Avro entry 19 by 6.7% on MasterCI, the Avro originals moved 1.048-1.056 locally and their copies 1.044-1.058 (JSONEachRow: 1.0172 and 1.0145). That is about 21 s less query time per master perf job on amd and 23 s on arm.

    Next: string_bytes_functions (one of its 4 queries, sum(stringBytesEntropy(s)) over 256M strings of zero or one byte, takes 3.12 s on amd and 2.48 s on arm on every master commit).

  15. groeneai commented on Nov 17, 2026

    @groeneai
    CollaboratorAuthor

    Next item: #132415, string_bytes_functions. Its query 1 (sum(stringBytesEntropy(s)) over 256M strings of zero or one byte, 3.12 s on amd and 2.48 s on arm) measured only the function's per-row fixed cost: every row zero-filled a 1 KiB table of 256 byte counters and then scanned all of them. The PR changes no test: stringBytesEntropy now scans only the range of byte values that occur in the row, with bit-identical results. Locally query 1 goes from 2.5 s to 0.17 s and queries 0, 2 and 3 stay at 0.97-1.00 of their time, which is about 2.9 s less query time per master perf job on amd (arm not measured locally).

    Next: add_distinct_to_in_clause (its query 0, the enable_add_distinct_to_in_subqueries = 0 half of its pair, takes 3.07 s on amd and 2.83 s on arm on every master commit).

  16. Algunenano commented on Nov 17, 2026

    @Algunenano
    Member

    @groeneai Please list the PRs pending review and throttle things. This is impossible to follow

  17. groeneai commented on Nov 17, 2026

    @groeneai
    CollaboratorAuthor

    Open PRs of this series, all waiting for review (20 merged and 2 closed so far):

    PR File Saving per master perf job (amd / arm)
    #129655 adaptive_aggregation_heavy_payload 4 queries of 1.5-4.4 s on amd moved to hits_10m_single (0.17-0.46 s projected)
    #131570 hash_join_with_row_store_strings ~60 s / 36 s
    #131761 jit_sort ~30 s / not measured
    #131775 hierarchical_dictionaries (engine fix in dictGetDescendants) 5 queries from ~1 s to 0.13-0.18 s locally
    #132196 lazy_columns_replication (approved) ~40 s / 35 s
    #132233 re2_regex_caching ~30 s / 22 s
    #132277 generate_random_json ~24 s / 17 s
    #132300 constant_column_search ~37 s / 24 s
    #132357 formats_columns_nullable ~21 s / 23 s
    #132415 string_bytes_functions (engine fix in stringBytesEntropy, CI running) ~2.9 s / not measured

    Throttle, starting now: I will not open another PR in this series until these are merged or closed. After that I will keep at most 3 open at a time and post here once per batch, not once per file. add_distinct_to_in_clause, announced above, is paused before its PR. If you prefer one combined PR per batch of files instead, say so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

comp-ci-infrastructure

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions