Repository navigation
Conversation
* Added CacheBase<const Block *, Block>(LRU) that stores already decompressed blocks
|
This is an automated comment for commit f0de5dc with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
* Check is hash_join_compression allows to avoid going to cache if there is no need
|
Dear @vdimir, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
The idea is sound. We can use compression first before oom or spilling to disk. This should apply for hash, parallel hash, and grace hash. But we need to test performance. |
|
Thanks for this @p1rattttt. The idea is sound — compressing the right-side blocks in memory is a useful step before reaching an out-of-memory condition or spilling to disk. Since this branch has diverged significantly from the current Re-implemented in: #107667 |
Re-implementation of the idea from PR ClickHouse#63696 ("Added possibility of compressing in HashJoin") against the current `HashJoin`/`ScatteredBlock` architecture, with the direction adjusted so compression is an adaptive step taken *before* an out-of-memory condition or spilling to disk, and so it covers `hash`, `parallel_hash` and `grace_hash` (which all build on the same `HashJoin`). New settings: - `enable_join_in_memory_compression` (Bool, default false): when a hash-based join hits memory pressure (the same trigger as block shrinking: more than half of `max_bytes_in_join`, or half the query memory limit), compress the stored right-side blocks instead of only shrinking them. Wired through both the legacy `Settings` path and the analyzer `JoinSettings` / `QueryPlanSerializationSettings` path. - `join_decompressed_columns_cache_bytes` (UInt64, default 128 MiB): bounds the per-join cache of decompressed right-side blocks used during the probe phase. Build side: `shrinkStoredBlocksToFit` and the shrink-on-insert path in `addBlockToJoin` compress stored columns (`IColumn::compress`) when the setting is on, setting `have_compressed`. Reranging is skipped for compressed data. Probe side: stored `ColumnsInfo` are decompressed on demand through a thread-safe `CacheBase` keyed by the stored block pointer (so a block is decompressed once and reused). The lazy `buildOutputFromBlocks` path, the limit/offset path, `joinGet`, the non-lazy ANY path, and the RIGHT/FULL non-joined-rows streams all translate stored pointers through the cache; `buildOutputFromRowRefLists` (which reads raw `RowRefList` pointers) is bypassed when compression is active. Performance (measured, 2M-row 1:1 `INNER JOIN`, full payload through the join): compressible payload shrinks the build side ~2.4x (402 -> 168 MiB) at ~1.85x probe time; incompressible payload saves no memory but still costs ~1.5x. Hence the feature is opt-in and only triggers under memory pressure: it lets a memory-bound compressible join complete in memory instead of failing or spilling. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Added possibility of compressing in HashJoin
Documentation entry for user-facing changes