DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

How HyperLogLog Estimates 100 Billion Things in 12 Kilobytes

HyperLogLog estimates distinct values from a compact sketch instead of storing every ID. Redis uses up to 12 KB per sketch, but the result is approximate and cannot answer membership questions.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HyperLogLog can estimate how many distinct values have appeared while keeping a compact sketch instead of every identifier. In Redis, that sketch uses up to 12 KB, plus key overhead, and Redis documents a 0.81% standard error. The title’s 100-billion figure is an illustrative scale, not a Redis benchmark: the result is an estimate, not an exact count, and the sketch cannot tell you whether a particular identifier was seen.

Why counting distinct values can take so much memory

To count unique visitors exactly, a system must distinguish an identifier it has already encountered from a new one. An exact set can do that, but it must retain the distinct values (or equivalent information sufficient to distinguish them), so its memory use grows as the set grows.

As an Amazon Associate I earn from qualifying purchases.

HyperLogLog trades away exactness and membership lookup. It summarizes hashed inputs in a small set of counters rather than retaining the original values. That makes it useful for aggregate questions such as “How many unique visitors did the site have today?” when a compact estimate is more useful than an exact list.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the sketch turns rare patterns into a count

For intuition, imagine hashing each input into a well-distributed bit string. Part of the hash selects one of many registers; the remaining bits are examined for a leading-zero pattern. A register keeps its largest observed pattern. Long runs of leading zeroes are rare, so seeing one is evidence that many hashes have been processed.

One register is noisy, so HyperLogLog combines information across many registers to reduce variation. The estimator uses a harmonic mean, with corrections for small and large ranges. This is an intuitive overview, not a full derivation of the algorithm.

What “12 kilobytes” means in Redis

The size is specific to Redis’s implementation, not a universal size for every HyperLogLog library. Redis documents a dense representation of 12,288 bytes: 16,384 six-bit counters plus a 16-byte header. Redis can also use a sparse representation that takes less space. The stated limit is up to 12 KB per sketch, plus a few bytes for the key, regardless of how many observations have been processed.

The “100 billion” in the title is an illustrative scale from the cited article, not a documented Redis performance test or benchmark. The memory claim describes the sketch’s bounded representation; it does not establish a measured throughput or accuracy result at that cardinality.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How accurate is the estimate?

Redis documents a standard error of 0.81% for its HyperLogLog cardinality estimate. Standard error is not a hard maximum deviation for every result, nor a guarantee that each answer falls within 0.81% of the true count. It is Redis’s documented error statistic for its implementation.

Because the sketch does not retain the original identifiers, it cannot return the set, identify which values were counted, or answer whether a specific visitor or event ID has appeared.

Use HyperLogLog with Redis

Redis exposes three core commands for adding observations, estimating cardinality, and combining sketches:

Task Redis command What it does
Add observations PFADD key element... Adds values to the sketch stored at key.
Estimate cardinality PFCOUNT key Returns an approximate count for the sketch.
Combine sketches PFMERGE destination source... Merges source sketches into a destination sketch.

For example, a service can add each observed visitor ID to a daily sketch with PFADD visitors:2026-10-04 visitor-id, then retrieve its approximate distinct count with PFCOUNT visitors:2026-10-04. The identifier here is an input to the sketch; Redis does not preserve it for later membership checks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To roll up partitions or periods, merge their sketches with PFMERGE visitors:week visitors:day1 visitors:day2, or use multi-key PFCOUNT to estimate the union directly. A union estimate accounts for overlapping inputs approximately through the sketch; it does not require retaining all original IDs. Redis notes that multi-key PFCOUNT does more work and has different performance characteristics from counting one key.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When an estimate is the wrong tool

Decision Exact hash set HyperLogLog
Cardinality Exact Approximate
Check whether a particular item was seen Yes No
Memory as distinct values grow Grows with retained values Bounded by the implementation and configuration; Redis uses up to 12 KB per sketch
Combining partitions Requires retaining values and applying a set/union strategy Sketches can be merged or counted together in Redis
Good fit Billing, payment deduplication, or coupon redemption when exactness matters Aggregate estimates such as unique visitors or distinct search queries

Choose an exact structure when a wrong count or a missed duplicate can trigger a charge, authorize a payment, or grant a benefit. HyperLogLog answers a different question: approximately how many distinct inputs occurred, without retaining the inputs themselves.

Sources and implementation context

Redis’s HyperLogLog documentation describes the data type and its commands. Its PFCOUNT command documentation explains the approximation, standard error, and memory representation. The illustrative 100-billion framing and algorithm overview appear in Athreya aka Maneshwar’s article on HyperLogLog.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.