Skip to content

Faster estimateCompressionRatio with the NONE codec - #111107

Merged
rienath merged 5 commits into
masterfrom
faster-none-estimation
Jul 23, 2026
Merged

rienath merged 5 commits into
masterfrom
faster-none-estimation

Conversation

@rienath

@rienath rienath commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

CompressionCodecNone now implements tryGetCompressedSize, so CompressedSizeCalculator (#109054) just gives the size of the data instead of copying it into scratch and then checking.

Looks like a useless performance optimisation, but #105404 stores uncompressed block if compression results in negative compression (which does happen sometimes). In such cases, we want to know the size of uncompressed codec for free.

image

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Faster estimateCompressionRatio with the NONE codec

Version info

  • Merged into: 26.8.1.35 (included in 26.8 and later)

@clickhouse-gh

clickhouse-gh Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [998c7cc]

Summary: ✅


AI Review

Summary

This PR adds a tryGetCompressedSize fast path for CompressionCodecNone, which lets estimateCompressionRatio compute NONE block sizes without copying the data into a scratch buffer first, and it adds matching stateless and performance coverage. I did not find a correctness, compatibility, or test-coverage issue in the current diff.

Final Verdict

✅ No blockers or majors.

@clickhouse-gh clickhouse-gh Bot added the pr-performance Pull request with some performance improvements label Jul 20, 2026
rienath added a commit that referenced this pull request Jul 20, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 27 queries analysed

This PR adds a fast-path compressed-size estimate for the NONE compression codec (used only by estimateCompressionRatio('NONE')) plus its tests; it does not touch any code path a ClickBench SELECT query executes. Every flagged improvement was measured against a single baseline run (k_base=1), and Q28's baseline (6646 ms) was an outlier sitting above master's current-era band while the source median (1052 ms) sits inside it. All of these deltas are baseline/run-to-run variance rather than real PR effects, so the directional improvements are downgraded to not_sure. No cross-query pattern is present and no query plausibly regresses from this change.

clickbench

⚠️ 7 inconclusive

Flagged queries (7 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 11 not_sure 201 173 -13.9% <0.0001 This PR only adds a fast NONE-codec size shortcut for estimateCompressionRatio('NONE'); Q11 never executes that path, so the -13.9% shift against a single-run baseline is variance, not a PR effect.
⚠️ 18 not_sure 1330 1238 -7.0% <0.0001 Already not_sure with mixed signals from the two tests; the change also can't come from this PR, which only touches the NONE compression-codec size estimate Q18 never runs.
⚠️ 23 not_sure 169 73 ×2.3 faster <0.0001 The ×2.3 faster reading is against a single-run baseline; Q23 does not exercise the NONE-codec size estimate this PR changes, so the delta is baseline noise.
⚠️ 28 not_sure 6646 1052 ×6.3 faster <0.0001 The ×6.3 faster reading comes from an anomalously slow single baseline run (median 6646 ms sits above master's current band 1015-4435 ms while source is inside it); the PR's NONE-codec change can't touch Q28.
⚠️ 30 not_sure 318 269 -15.4% <0.0001 Q30 doesn't call the NONE-codec size estimate this PR adds; the -15.4% against a single-run baseline is run-to-run variance.
⚠️ 31 not_sure 393 347 -11.7% <0.0001 Off the changed code path; the -11.7% against a thin single-run baseline is variance, not attributable to this PR.
⚠️ 32 not_sure 1368 1288 -5.9% 0.0003 Already not_sure with mixed test signals; also off-path since this PR only changes the NONE-codec compressed-size estimate, which Q32 does not run.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

Debug info
  • StressHouse run: ee773186-fed1-4e30-89ef-13f6c7754f12
  • MIRAI run: 04c05d1a-c89e-45e1-a7aa-c6aa027bd860
  • PR check IDs:
    • clickbench_12526_1784807650
    • clickbench_12532_1784807650
    • clickbench_12549_1784807650
    • tpch_adapted_1_official_12556_1784807650
    • tpch_adapted_1_official_12580_1784807650
    • tpch_adapted_1_official_12594_1784807650

@thevar1able thevar1able self-assigned this Jul 21, 2026
@rienath

rienath commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

@groeneai why is CI red? Are we out of memory? Is there a fix?

@groeneai

Copy link
Copy Markdown
Collaborator

Red = one shard only: Performance Comparison (amd_release, master_head, 1/6). The other 11 perf shards and every other check are green; "Mergeable Check" and "PR" are just aggregators reflecting that one shard.

Not OOM. The runner died with System.IO.IOException: No space left on device while writing its own diag log (/home/ubuntu/actions-runner/_diag/...), i.e. the CI host ran out of disk. The shard errored before running anything, so it produced no report (all its artifacts 403). Unrelated to this change (diff only touches CompressionCodecNone::tryGetCompressedSize, and it is already approved).

Fix: no code change needed, just re-run that one failed job.

@rienath

rienath commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@groeneai why does this happen only on amd and not arm? Do we shard the same way in both cases?

@groeneai

Copy link
Copy Markdown
Collaborator

Same sharding on both arches: Performance Comparison (<arch>_release, master_head, N/6), 6 shards each (12 total), identical split. So this is not an amd-vs-arm difference.

The single red (amd 1/6) is a per-host infra event: that GHA runner ran out of disk (No space left on device while writing its own _diag/Worker_*.log), so the runner worker process crashed and the job produced no results. It landed on an amd runner by chance; an arm runner would be affected the same way. Nothing arch-specific, and nothing from the diff. A re-run clears it.

@rienath

rienath commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@groeneai merge master into this PR, failing test was fixed

@groeneai

Copy link
Copy Markdown
Collaborator

I don't have write access to this branch, so I can't merge for you - please click "Update branch" on the PR (or git merge origin/master && git push). The branch is currently 149 commits behind master.

FWIW the perf shard that was red (Performance Comparison (amd_release, master_head, 1/6)) is already green on the current head. Three non-perf checks are still red though: Integration (db disk, old analyzer, 5/6), Stateless (amd_llvm_coverage, ParallelReplicas, s3), and Fast test (arm_darwin). The master merge re-runs all of them and will clear any that were fixed upstream.

@clickhouse-gh

clickhouse-gh Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.20% 86.20% +0.00%
Functions 92.00% 92.00% +0.00%
Branches 78.30% 78.30% +0.00%

Changed lines: Changed C/C++ lines covered: 1/1 (100.00%) · Uncovered code

Full report · Diff report

@rienath
rienath added this pull request to the merge queue Jul 23, 2026
Merged via the queue into master with commit 3c38d2e Jul 23, 2026
180 checks passed
@rienath
rienath deleted the faster-none-estimation branch July 23, 2026 15:13
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 23, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…mation

Faster `estimateCompressionRatio` with the `NONE` codec
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-performance Pull request with some performance improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants