HyperLogLog
A counter of distinct things that keeps none of them. It answers “how many different?” to within about a percent, using an amount of memory that does not grow with the answer.
Where this is actually used
Redis ships this as a built-in type, and Google, Presto and Elasticsearch all use it. Counting unique visitors with an exact set costs memory proportional to the visitors; HyperLogLog counts them in about 12 KB whether there were ten thousand or ten billion.
The guarantee
Standard error ≈ 1.04/√m. A register value never decreases.
How it works
It stores no items. It keeps the longest run of leading zeros seen in each register, reasons that long runs are rare, and counts distinct values from that.
Flajolet, Fusy, Gandouet & Meunier, AofA 2007
Stream
Parameters
the entire memory cost, one byte each, no matter how many items arrive
Registers are always a power of two, since the index comes from the top p bits of the hash. Four times the registers halves the error.