Repository navigation
Make reading_from_file perf test deterministic to reduce noise - #106249
Merged
alexey-milovidov merged 1 commit intoJun 2, 2026
Merged
alexey-milovidov merged 1 commit into
alexey-milovidov merged 1 commit into
Conversation
The fill query `SELECT URL FROM test.hits LIMIT 100000` has no `ORDER BY`, so with parts read by multiple threads the `LIMIT` returns a different 100000 rows on each server. Because `base58Encode` cost is super-linear in string length, the two servers get persistently different workloads and the comparison is frequently reported as `unstable`/`slower`/`faster`. Add `ORDER BY URL` so both servers encode the same deterministic subset. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
3 of 11 tasks
Contributor
|
Workflow [PR], commit [26949d7] Summary: ✅
AI ReviewSummaryThis PR makes Final VerdictStatus: ✅ Approve |
alexey-milovidov
approved these changes
Jun 2, 2026
This was referenced Jun 2, 2026
pull Bot
pushed a commit
to sowelswl/ClickHouse
that referenced
this pull request
Jun 6, 2026
ClickHouse#106278 tried to remove the LIMIT-without-ORDER-BY non-determinism by sampling with WHERE cityHash64(WatchID) % N = 0. Post-merge master data showed it did not work: it made the measured queries scan the whole table on every run, so instead of reducing the noise it regressed it badly: classification #0: 6.5% -> 76% noisy classification #1: 10% -> 90% noisy (#2/#3/#4 were already clean.) Materialize the deterministic subset once into its own single-part table (single-threaded insert + OPTIMIZE FINAL) and measure over that, so the determinism lives in the setup (like ClickHouse#106249 for reading_from_file) and the measured queries read only the subset instead of rescanning the source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
reading_from_fileperformance test is one of the noisiest tests tracked in #100759 (arm 67% / amd 59% noisy in master runs).Root cause: the fill query
SELECT URL FROM test.hits LIMIT 100000has noORDER BY, so when the parts are read by multiple threads theLIMITreturns whichever 100000 rows win the read race, and each of the two compared servers ends up with a different subset of URLs in its parquet file. Becausebase58Encodecost is super-linear in string length, a slightly different (heavier-tailed) subset costs disproportionately more, so one server is persistently slower than the other within a run and the verdict flips randomly across runs.Evidence from a master self-comparison (
old_sha == new_sha): sameSelectedRowson both sides,SelectedBytesdiffers by 9%, butUserTimeMicrosecondsandclient_timediffer by ~2x. Reproduced locally againsttest.hits: independent runs of the old fill produce 2.53-5.00 MB of URL data and 0.036-0.167s query time, a 4.6x swing; withORDER BY URLthe fill is byte-for-byte identical and the time is constant at ~0.137s.This is the same class of issue as the
apply_patch_parts_joinfix in #105527.ORDER BY URLmakes both servers encode the same deterministic subset. The fill query is not measured, so the sort cost is irrelevant.Changelog category (leave one):
Version info
26.6.1.314