Repository navigation
Sampling for Hypothetical Indexes - #126991
Conversation
|
Workflow [PR], commit [bbd6bd0] Summary: ✅
AI ReviewSummary
Final Verdict✅ Approve. |
…last run does not bias the estimate
… marks do not bias the estimate
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes8 object files changed (+57.80 KiB total), 1 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units12 translation units recompiled, 40 s compile time in total, 11 of them have a recent master baseline. |
…ps the row order `INSERT ... SELECT * FROM t_tail` read the three parts in parallel, so the rows of `x >= 10000` fell into more granules of the copy (5 instead of 3). https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126991&sha=latest&name_0=PR&name_1=Stateless%20tests%20(amd_asan_ubsan%2C%20flaky%20check) #126991
…le in proportion to its marks With primary-key pruning the windows can hold very different numbers of baseline marks. A sample of windows then often missed the few windows with most of the marks, and the span came from the count of windows, not of marks (`marks: 0`, `marks_span: 0 to 5990`, real 30000). Now each run takes one baseline mark and reads its window, which stands for the marks of the runs that took it. #126991 (comment)
…the time limit of the sanitizer flaky checks
…nd take it as the least sampling error of a skip-index estimate
… and the not skipped marks of the sampled windows, so it is in `marks_span`
…f `05408`, so the test writes half the marks
…arks, so the test fits the time limit of the private sanitizer flaky check
… the test does not run the full-scan oracles and fits the time limit of the private sanitizer flaky check The private check `Stateless tests (amd_asan_ubsan, flaky check, s3 storage, meta in keeper)` still stopped `05408` at 180 s (runs took 120-180 s). Its query_log shows that the full-scan `EXPLAIN WHATIF` queries read about 70% of the marks of the test. The first case still checks that a full scan is exact against the twin table. Report: https://s3.amazonaws.com/clickhouse-test-reports-private/praktika.html?PR=83399&sha=2c3d807640cbd89abe6afec01d17278a5bde59c5&name_0=PR&name_1=Stateless%20tests%20(amd_asan_ubsan%2C%20flaky%20check%2C%20s3%20storage%2C%20meta%20in%20keeper) PR: #126991 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… for all parts, and take 3 heaviest draws as the least error, so many light draws do not hide a heavy one A run for each part gave a part with dense windows one draw of 64 marks next to 500 draws of 4 marks of the other part. The effective count of draws was 352, so the rule of three gave `marks: 0`, `marks_span: 0 to 26`, real 32. Now all parts use the same run, so a part gets draws in proportion to its baseline marks (here both windows of the dense part, `marks: 32`, `marks_span: 32 to 57`). With draws of unequal weights, a change that no draw found has fewer marks than 3 heaviest draws with a 95% chance, so this is the least error. #126991 (comment) #126991 (comment)
…o a part that the sample reads fully, because the draws decide which parts these are and their exact counts biased the estimate
…the weighted distances from the mean, so a heavy draw next to a light draw of a short last run keeps all its variance in `marks_span`
…ColumnsPass The pass set the type of every reference to an ARRAY JOIN column (the first argument of `tupleElement`) to the type of the ARRAY JOIN expression, for every expression, pruned or not. The analyzer can give a reference a different type than the definition: `join_use_nulls` (ARRAY JOIN on the nullified side of a RIGHT/FULL JOIN) and `group_by_use_nulls` (the column is a ROLLUP/CUBE key) make it `Nullable`, and a `USING` key gives it the common supertype. After the overwrite `tupleElement` was re-resolved to the narrower type while its parent function still expected the old one, so the query tree validator of debug and sanitizer builds threw `LOGICAL_ERROR` "Function tupleElement(__array_join_exp_1, 'a') > 0 expects argument 1 to have Nullable(Int64) type but receives Int64 after running PruneArrayJoinColumns pass". Release builds were not affected: the planner rebuilds a function whose argument types do not match. Now `pruned_type` is set only when `pruneNestedFunctionArguments` actually pruned the expression, so references of other expressions keep their type, and a reference of a pruned expression keeps its own `Nullable`. A `USING` key or a matcher column is a direct reference, which marks the expression fully used, so it is never pruned. Found by the server-side AST fuzzer in Stress tests (PR ClickHouse#126991, ClickHouse#118582, ClickHouse#115763). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #121766
EXPLAIN WHATIFestimates a hypothetical skip index by building the index in memory. Until now it read every index window that touches the baseline marks. On a large table this reads a lot of data.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
EXPLAIN WHATIFestimates a hypothetical skip index from a sample of index windows when the scan would read more thanindex_scan_budget_rowsrows (10 million by default). It shows the sampling error asmarks_spanWorkflow [PR]
Sync PR [sync-upstream/pr/126991]
Version info
26.11.1.1118-master(included in26.11and later)