ClickHouse Packs a HyperLogLog Rank Into Five Bits
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.
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.
ClickHouse’s ArenaWithFreeLists keeps one free list per power-of-two size class and threads the free-list link through the freed block itself.
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.
ClickHouse’s default cache policy is SLRU, not LRU: entries hit twice are promoted to a protected queue that a sequential scan cannot flush.
ClickHouse defers heavy and/or/if arguments into a thunk and runs them only on the rows a UInt8 mask leaves undecided.