Skip to content
Opensource internals
  • Posts

Internals

ClickHouse Packs a HyperLogLog Rank Into Five Bits

Oct 19, 2026 19 min read Jay Hubbert

ClickHouse’s CompactArray stores sub-byte values in a bitset and reads them through an unaligned 16-bit window, so a HyperLogLog rank costs 5 or 6 bits per bucket.

ClickhouseInternalsPerformanceBit tricksMemory

Read more →

ClickHouse Recycles Small Objects Through Per-Size Free Lists

Oct 19, 2026 18 min read Jay Hubbert

ClickHouse’s ArenaWithFreeLists keeps one free list per power-of-two size class and threads the free-list link through the freed block itself.

ClickhouseInternalsMemoryPerformanceData structures

Read more →

ClickHouse's LRU Cache Keeps Its Order in a Linked List

Oct 19, 2026 20 min read Jay Hubbert

ClickHouse’s LRU cache is a hash map of cells pointing into a linked list, so a lookup is an O(1) splice and eviction is a pop from the front.

ClickhouseInternalsCachingPerformanceData structures

Read more →

ClickHouse's SLRU Cache Gives Hot Entries a Second Queue

Oct 19, 2026 20 min read Jay Hubbert

ClickHouse’s default cache policy is SLRU, not LRU: entries hit twice are promoted to a protected queue that a sequential scan cannot flush.

ClickhouseInternalsCachingPerformanceAlgorithms

Read more →

ClickHouse Short-Circuits AND and OR with a Mask and a Deferred Column

Oct 19, 2026 21 min read Jay Hubbert

ClickHouse defers heavy and/or/if arguments into a thunk and runs them only on the rows a UInt8 mask leaves undecided.

ClickhouseInternalsPerformanceShort circuit

Read more →

← Newer Page 16 of 41 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·