ClickHouse Estimates topK with a Space-Saving Counter and an Error Bound
ClickHouse’s topK uses Filtered Space-Saving: each candidate keeps a count and an error bound, and the least accurate counters are dropped when the table overflows.
ClickHouse’s topK uses Filtered Space-Saving: each candidate keeps a count and an error bound, and the least accurate counters are dropped when the table overflows.
ClickHouse’s default cache policy is SLRU, not LRU: entries hit twice are promoted to a protected queue that a sequential scan cannot flush.