ClickHouse Estimates Distinct Counts by Thinning a Hash Table
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…
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…
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…
ClickHouse’s hash table has no occupancy bit, no tombstone, and no sentinel pointer.
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…
A GROUP BY needs a serial merge at the end — and that’s where the memory high-water mark lives.