Skip to content
Opensource internals
  • Posts

Hash table

ClickHouse Estimates Distinct Counts by Thinning a Hash Table

Oct 21, 2026 22 min read Jay Hubbert

uniq() is a hash table that deliberately throws data away. When it fills up, it halves its sample rate, keeps the survivors, and multiplies the count back up by the…

ClickhouseInternalsAggregationProbabilisticHash table

Read more →

ClickHouse Evaluates IN with Hash Sets

Oct 21, 2026 21 min read Jay Hubbert

IN is not a comparison, it is a hash set. ClickHouse picks one of thirteen specialisations based on the shape of the right-hand side, packs integer keys into the hash…

ClickhousePerformanceInternalsHash tableSet

Read more →

ClickHouse Marks Empty Hash Table Cells With Zeroed Memory

Oct 21, 2026 24 min read Jay Hubbert

ClickHouse’s hash table has no occupancy bit, no tombstone, and no sentinel pointer.

ClickhouseInternalsHash tablePerformanceMemory

Read more →

ClickHouse Packs Short Strings Into Hash Table Keys: No Allocation Per Key

Oct 21, 2026 14 min read Jay Hubbert

ClickHouse never stores a std::string in a hash table cell. It splits keys into size classes and packs strings of up to 24 bytes into plain integers, so your GROUP BY…

ClickhouseInternalsHash tableStringsPerformance

Read more →

ClickHouse Splits GROUP BY into 256 Buckets for Parallel Merges

Oct 21, 2026 15 min read Jay Hubbert

A GROUP BY needs a serial merge at the end — and that’s where the memory high-water mark lives.

ClickhouseInternalsHash tableAggregationParallelism

Read more →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·