Redis HyperLogLog can estimate how many distinct values you have seen without retaining every value: Redis documents a maximum of 12 KB per sketch and a 0.81% standard error rate. That makes it useful for aggregate metrics such as unique visitors, provided an estimate is acceptable. It cannot tell you which values were counted or whether a particular value is present.
What Redis HyperLogLog does—and what it cannot do
HyperLogLog is a probabilistic data structure for estimating cardinality: the number of distinct items in a stream. Redis documents it for tasks such as estimating unique web-page visitors or unique search queries. The sketch keeps information needed for an aggregate estimate, not a retrievable record of its members. Redis documentation, accessed 2026.
As an Amazon Associate I earn from qualifying purchases.
Redis documents a maximum of 12 KB per HyperLogLog and a standard error rate of 0.81%. Standard error describes the estimator’s expected statistical behavior; it is not a guarantee that every individual result will be within 0.81% of the true count.
Free tools Windows power users keep installed
One-click scans. No signup required.
- Use it when approximate distinct counts or approximate unions answer the reporting question.
- Use an exact set or another exact data model when you must enumerate values, check individual membership, or make a decision that requires an exact count.
Redis encodes HyperLogLogs as strings and supports serialization with GET and SET. That representation is not a list of the values added to the sketch.
#1 Best Overall
How to add values, count them, and combine sketches
Redis provides three core commands: PFADD adds values, PFCOUNT estimates cardinality, and PFMERGE combines sketches to estimate the union. Redis HyperLogLog documentation.
- Add: call
PFADDwith the sketch key and the values to include. - Read: call
PFCOUNTon that key to get an estimated distinct count. - Combine: call
PFMERGEto create or update a destination sketch from source sketches, then count the destination when an approximate union is needed.
The wredis PyPI listing documents this Python example:
Rank #2
from wredis.hyperloglog import RedisHyperLogLogManager
hll = RedisHyperLogLogManager(host="localhost")
hll.add("visitors", "user1", "user2", "user3")
count = hll.count("visitors")
hll.merge("all_visitors", "visitors")
The listing describes RedisHyperLogLogManager and the add, count, and merge methods. Treat this as the package’s documented API example, not an independently validated deployment recipe. Check the API for the release you install at the wredis package listing.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →What changes when counting one key versus several
Redis documents one-key PFCOUNT as O(1) with a small average constant time. When given multiple keys, PFCOUNT performs an on-the-fly merge and is O(N) in the number of keys. Redis also notes that the multi-key operation cannot cache the union’s cardinality in the same way as a count of one key. These complexity descriptions do not establish end-to-end latency for a particular workload. Redis PFCOUNT command reference, accessed 2026.
Rank #3
If a combined count is requested repeatedly, consider maintaining a destination sketch with PFMERGE rather than repeatedly asking Redis to merge many source keys during each multi-key count. That changes the operational workflow, so choose it based on how often source sketches change and how fresh the combined result must be.
How to design sketches for production reporting
Choose stable input values
Decide how each real-world item maps to the value sent to Redis before ingestion. For example, use a consistent visitor identifier rather than sometimes adding an account ID and sometimes a session ID. The wredis listing does not establish a package-specific canonicalization policy; consistency is an application responsibility.
Rank #4
Match key boundaries to the question
Name sketches around the reporting unit, such as a daily visitor sketch, when the product needs daily distinct counts. Decide how sketches roll over and when they are removed as part of the application’s data lifecycle. The cited sources do not establish automatic TTL behavior for the wredis HyperLogLog API, so configure and verify expiration separately if it is required.
Recommended Free Tools
Check the installed package and runtime
The PyPI listing states that wredis requires Python 3.9 or later and lists version 1.0.3 with an upload date of August 14, 2026. Confirm the selected release, its documented API, and compatibility with your runtime before relying on the example. Those package details are listing claims, not independent evidence of production-scale reliability or performance. wredis on PyPI.
Best Value
HyperLogLog or an exact set?
| Decision factor | Redis HyperLogLog | Exact set |
|---|---|---|
| Count accuracy | Approximate cardinality; Redis documents a 0.81% standard error rate. | Exact count of retained distinct members. |
| Memory behavior | Redis documents a maximum of 12 KB per sketch. | Storage grows with retained members; no specific memory total is established here. |
| Query needs | Aggregate cardinality and approximate unions; does not enumerate members or answer individual membership checks. | Can support enumeration and individual membership checks. |
| Combining data | Sketch union gives an approximate result. | Union of stored members can be exact. |
Redis figures in the table are from its current documentation, accessed in 2026: HyperLogLog behavior. No set-memory benchmark is implied.
Quick Recap
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.




