Recording intelligenceAI-generated brief · check the source for context

HyperLogLog — count millions of unique things in a few KB

11:10 recording · EN · 1 speaker

Watch the original

Brief overview

HyperLogLog counts millions of different viewers in about 12 kilobytes by keeping lottery cards, not people.

  1. Trade exactness for memory that never growsWhether a million people watch or a billion, it is the same 16,000 boxes and about 12 kilobytes, at roughly 1% error.
  2. The same person always gets the same cardBecause the card comes from the viewer's ID, watching 100 times changes nothing, which is why the count is of different people and not views.
  3. Merging adds crowds, it never subtracts themKeep the bigger rarest win box by box to combine servers or days, but you cannot remove a day later or find the overlap between two sets.
Executive Summary AI
  • The recording opens on a short-video feed watched by millions and the question that is hard to answer: how many different people watched one clip, not how many views, because counting exactly means remembering every viewer, which grows to billions of entries.
  • HyperLogLog throws that list away and returns an estimate instead of an exact number, usually within about 1% (about 8.2 million rather than exactly 82 lakh 31,004), and it can never say whether one specific person watched.
  • The idea is a lottery: every viewer gets a scratch card decided by their ID, only the rarest win seen is kept, and because the same person always gets the same card, a repeat viewer adds nothing.
  • To stop one freak card from wrecking the estimate, viewers are split by ID across about 16,000 boxes, each running its own lottery, and a typical box's little crowd is multiplied by 16,000 — a hundred per box gives about 1.6 million.
  • Two sketches merge box by box by keeping the bigger rarest win, which never double counts, so servers, days or regions can be added freely — Redis, Reddit and data warehouses rely on this — but you cannot subtract a day back out or find an overlap.
Key Quote
“Not how many views, how many different people.”
— Speaker
Key Quote
“It only ever gives you the count, never a yes or no about one person.”
— Speaker
Key Quote
“Nobody counted the players, but the rarity of the win tells you how many were there.”
— Speaker