Repository navigation
Choose the codec of an inserted part by the size of the inserted block - #127652
Conversation
The size-aware default codec (`LZ4` below 100 MB, `ZSTD(3)` above) was evaluated with size `0` for every inserted part, so all inserted data was written with `LZ4` and then rewritten with `ZSTD(3)` by merges. Use the uncompressed size of the inserted block instead: small inserts still use `LZ4`, and large ones get `ZSTD(3)` right away. Split from #126251 #126251 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [8c5adc4] Summary: ✅
AI ReviewSummaryThe PR selects the insert-time compression codec using the uncompressed size of each partition's block, allowing large inserts to use Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; integration validation remains pending. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 16 s compile time in total, 7 of them have a recent master baseline. Symbol sizes
|
…me size-aware Since ClickHouse#127652 an inserted block larger than `min_part_size_for_default_codec` is written with the default codec (ZSTD(3)) instead of LZ4. The test inserts 5000 copies of one 104857-byte string per partition; ZSTD collapses the repetition, so each part shrank from ~500 MB to ~34 MB and a fetch now lasts about one second, i.e. about one ASan poll iteration. The polling loop's only exit was "6 distinct part names were observed in system.replicated_fetches". In MasterCI c0e5c9a (amd_asan_ubsan, db disk) the first poll was delayed 2.4 s by system-log table creation on the remote database disk, so the first batch of 3 fetches started and finished unseen, `fetched_parts` stayed at 3 and the loop spun into the 900 s pytest timeout, although all 6 fetches had finished within 3 s. Pin `CODEC(LZ4)` on the payload column (the repeated string is longer than LZ4's 64 KiB window, so the parts stay large again, as in ClickHouse#108786 for the sibling bandwidth tests), and exit the loop once node2 has all 6 parts active instead of once every transient fetch has been observed. The assertions are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The size-aware default codec (#108786:
LZ4below 100 MB,ZSTD(3)above) was evaluated with size0for every inserted part. So all inserted data was written withLZ4and then rewritten withZSTD(3)by merges. Now the uncompressed size of the inserted block is used: small inserts still useLZ4, and large ones (such asINSERT SELECTwith the default 256 MBmin_insert_block_size_bytes) useZSTD(3)right away.On ClickBench, the inserted parts take 8.85 GiB instead of 14.27 GiB, at the cost of about 33% more CPU in the insert. On slow disks (ClickBench uses EBS gp2, 250 MB/s), the load is bound by disk throughput, so less data written means a faster load.
Split from #126251, as requested in #126251 (comment).
Related: #126251
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Large inserts into
MergeTreetables now write their parts withZSTD(3)right away instead of writing them withLZ4first, because the size-aware default codec is now evaluated with the uncompressed size of the inserted block. This reduces the amount of data written during a bulk load.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/127652]
Version info
26.11.1.727-master(included in26.11and later)