Skip to content
Opensource internals
  • Posts

Clickhouse

ClickHouse's LowCardinality Column: One Shared Dictionary, and an Index That Widens as Keys Grow

Oct 17, 2026 26 min read Jay Hubbert

A LowCardinality column stores one byte per row instead of a whole string, because every block in a part points at the same dictionary — capped at 8192 keys and flushed when it …

ClickhousePerformanceInternalsMemoryCompression

Read more →

ClickHouse Sizes Granules in Bytes, Not Rows: Bit-Packed Marks and a Trimmed Primary Key Index

Oct 17, 2026 23 min read Jay Hubbert

A MergeTree scan isn’t a full scan. Parts are cut into granules, each granule gets a bit-packed mark, and the primary key index stores one key value per granule — so…

ClickhousePerformanceInternalsMerge treeStorage engineIndexes

Read more →

ClickHouse Turns IN into a Hash Set: Thirteen Variants, Then a Disk Spill

Oct 17, 2026 21 min read Jay Hubbert

ClickHouse picks one of thirteen hash-table shapes for IN based on the key type, then spills the set to disk behind per-block Bloom filters when it outgrows RAM.

ClickhousePerformanceInternalsHash tableSet

Read more →

ClickHouse Sorts Each Chunk and Discards Rows Early: A Threshold Before the Merge

Oct 16, 2026 17 min read Jay Hubbert

ClickHouse never sorts the whole dataset at once. It sorts each chunk, throws away rows that can’t make the top-N, merges the sorted streams, and spills runs to disk when…

ClickhouseInternalsSortingPerformance

Read more →

ClickHouse Scores Merge Candidates by Cost: sum_size / (count - 1.9)

Oct 16, 2026 20 min read Jay Hubbert

ClickHouse picks merge candidates with a tiny, explicit cost model: score each contiguous range as sum_size / (count - 1.9), pick the cheapest admissible one, and only ever…

ClickhousePerformanceInternalsMerge treeStorage engineBackground jobs

Read more →

← Newer Page 18 of 21 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·