Why it matters
Exact cardinality at scale impractical. HLL is standard approximate solution. Understanding shapes analytics.
Advertisement
The architecture
Hash each item.
Leading zeros of hash indicates rarity.
Max leading zeros correlates with distinct count.
Advertisement
How it works end to end
Buckets: partition hash space into m buckets. Each stores max leading zeros seen.
Estimation: harmonic mean of (2^bucket) values, scaled.
Merge: HLL sketches merge cleanly by taking max per bucket. Distributed friendly.