Skip to content
Opensource internals
  • Posts

Clickhouse

ClickHouse Aggregates In Order and Stops Reading Early

Oct 21, 2026 16 min read Jay Hubbert

If your table is sorted by the GROUP BY key, ClickHouse can skip the hash table entirely: it counts each contiguous run of equal keys and emits it.

ClickhouseInternalsAggregationPerformance

Read more →

ClickHouse Decides Which Parts to Merge: A Cost Model for Write Amplification

Oct 21, 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 →

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 JIT-Compiles Scalar Expressions with LLVM

Oct 21, 2026 17 min read Jay Hubbert

ClickHouse compiles hot scalar expressions to native code with LLVM.

ClickhousePerformanceInternalsJitLlvm

Read more →

← Newer Page 1 of 4 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·