v.19.15New Feature

Add a Sparse_hashed Dictionary Layout, That Is Functionally Equivalent to the Hashed Layout, But Is More Memory Efficient

Add a sparse_hashed dictionary layout, that is functionally equivalent to the hashed layout, but is more memory efficient. It uses about twice as less memory at the cost of slower value retrieval. #6894 (Azat Khuzhin)
Introduces a new sparse_hashed dictionary layout in ClickHouse that is functionally equivalent to the existing hashed layout but optimized for memory efficiency.

Why it matters

The sparse_hashed layout reduces memory usage by approximately half compared to the hashed layout, making it suitable for scenarios where memory constraints are critical. This optimization comes with a trade-off of slower value retrieval, allowing users to balance between memory consumption and query performance.

How to use it

To use the sparse_hashed layout, define your dictionary with the layout = 'sparse_hashed' parameter instead of hashed. This enables the new memory-efficient dictionary implementation while maintaining compatibility with existing dictionary usage.