Repository navigation
Stabilize join_convert_full_to_left_or_right perf test by disable merges - #119175
alexey-milovidov merged 4 commits into
Conversation
…test The test creates its two tables with `ORDER BY ()`, so there is no primary key and the pushed-down `uid < 100` predicate is resolved by the automatic column statistics. Those prune at part level, not at granule level, so the query reads in full the single part that holds `uid < 100`, and how many rows that is depends only on how the `INSERT` cut its parts and on how far the background merge has folded them together. The reported read amount therefore swung between 2223906 rows (the predicate still inside an unmerged 1.1M-row part on both sides) and 13343436 rows (a merged 6.7M-row part), with a merge landing between two runs making one server report both, so `SelectedRows`, `SelectedMarks`, `ReadCompressedBytes` and the times derived from them were reported as changed for two identical query plans - in https://performance.ci.clickhouse.com/runs/pr-106955-fc873716689ba5717d444b511537455090e21212/tests/join_convert_full_to_left_or_right the amd shard read 2223906 rows against the arm shard's 13343436, purely because their merges had progressed differently. `SYSTEM STOP MERGES` before the `INSERT` keeps the inserted parts as they were written, and pinning `max_block_size` and `min_insert_block_size_rows` makes the way they are cut a property of the settings rather than of the number of insert streams the machine chose: 10 parts of 1048576 rows, the last one 562816, on every server. The predicate then sits in the first part, `EXPLAIN indexes = 1` prunes to `Parts: 1/10`, and the query reads 2097152 rows over 256 marks, run after run - measured over 8 consecutive local runs, 11-24ms each. `OPTIMIZE TABLE ... FINAL` on both tables fixes the layout just as well, but it rewrites 10M rows per table during the fill (1.98s against 1.01s) and leaves the query reading the whole table on every run (20000000 rows, 2442 marks, 50-67ms). A single-block `INSERT` reaches one part without the rewrite, but holds the whole block in memory - 343 MiB against 67 MiB - and reads the full table too. Related: ClickHouse#106955 Signed-off-by: UnamedRus <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [0ce9500] Summary: ✅
AI ReviewSummaryThis PR stabilizes Findings💡 Nits
Final Verdict✅ The test change looks sound overall. One small comment-accuracy fix is still warranted. |
| that part was still a 1.1M-row one and 13343436 where it had already been | ||
| merged into a 6.7M-row one, and a merge landing between two runs made a | ||
| single server report both. The comparison then reports a change in | ||
| performance for two identical query plans - an amd shard read a third of |
There was a problem hiding this comment.
The arithmetic in this rationale doesn't match the numbers it quotes: 2223906 vs 13343436 is exactly one sixth, not one third. Since this comment is the design record for why the benchmark setup exists, can you fix the ratio so the explanation stays internally consistent?
`where n.null` is pruned by the automatic column statistics (basic, null_count) to the one part that holds row 0. The unpinned INSERT writes 8 parts (7 x 130818 + 84274 rows), and a background merge of parts 1-6 into a 784908-row part can complete before `perf.py --stop-merges` stops merges, which it does only after BOTH servers finished their fill. The server that fills faster gives that merge more time, so a fill-speed difference between the two compared binaries decides which layout each side measures: one server read 784908 rows / 229 marks, the other 130818 / 39, and the dashboard confirmed a +30% regression of query ClickHouse#1 on 11 unrelated PRs in Performance Comparison (arm_release, 4/6), where the official build used as the reference filled in ~3.9 s vs ~2.7 s. The confirmation reruns refill the table, so they repeat the asymmetry. Stop merges for the table before the INSERT and cut the parts by rows (max_insert_threads = 1, max_block_size = 65536, min_insert_block_size_rows = 131072, min_insert_block_size_bytes = 0), then assert the layout (8 parts, 7 x 131072 + 82496) with throwIf, the same pin as join_convert_full_to_left_or_right.xml (ClickHouse#119175). Queries are unchanged; query ClickHouse#1 now reads one 131072-row part on every server. Validated with the official master build and two local servers: the master XML with the merge allowed to finish reads 784908 rows / 229 marks (3/3); with the pin every trial reads 131072 rows and an OPTIMIZE is refused; perf.py --stop-merges with one server CPU-throttled gives 784908 vs 130818 on master and 131072 on both servers with the pin; removing either pin makes the throwIf fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Perf diff just because of merges:
Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/119175]
Version info
26.9.1.1263(included in26.9and later)