Quick revision
The short answer
We set policy by the purpose of each number: approximate counts are fine for live dashboards and capacity planning, while billing, contracts and external reporting use exact warehouse counts, and approximate figures are labelled. A 1 to 2 percent gap is expected from a 0.81 percent standard error, so we explain it rather than debug it. A HyperLogLog cannot forget one user, so we honour deletion by keeping these structures short-lived and rebuildable from source data that already respects deletions, with privacy counsel deciding how the registers are classified.
What to remember
In this answer, we set policy by purpose: approximate counts for live dashboards and capacity planning, exact warehouse counts for billing, contracts and external reporting, with approximate figures labelled. We explained the 1 to 2 percent mismatch as the expected result of a 0.81 percent standard error and differing definitions, and reconcile by method. Because a HyperLogLog cannot remove one user, we keep such structures short-lived and rebuildable from deletion-aware sources, with privacy counsel classifying the registers, and we document every approximate structure with an owner, error bound, TTL and rebuild source.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
We set policy by the purpose of each number: approximate counts are fine for live dashboards and capacity planning, while billing, contracts and external reporting use exact warehouse counts, and approximate figures are labelled. A 1 to 2 percent gap is expected from a 0.81 percent standard error, so we explain it rather than debug it. A HyperLogLog cannot forget one user, so we honour deletion by keeping these structures short-lived and rebuildable from source data that already respects deletions, with privacy counsel deciding how the registers are classified.
Why this question is asked
Two numbers that should match but do not are a classic source of lost trust: finance doubts the dashboards, product doubts finance, and engineers spend weeks hunting a bug that does not exist. Add a privacy request that a probabilistic structure cannot satisfy directly, and the question becomes one of policy, not code. Interviewers ask this to see whether a senior leader can set clear rules about which numbers are fit for which purpose and handle a legal obligation sensibly. In this answer, we will set the policy, explain the mismatch, answer the privacy request, make approximate structures a documented choice, and keep the cost argument visible.
1Start From the Purpose of Each Number
Every number has a job. A live dashboard showing unique users in the last hour helps people react; a figure that is 1 percent off does not change any decision. Capacity planning cares about trends and peaks. Billing, contractual commitments, investor reporting and anything given to a customer or regulator must be exact, reproducible and auditable.
So the policy is: approximate counts are allowed where the decision would not change within the error, and never where money, contracts or external statements depend on the number. Approximate figures are labelled in the interface, for example 'about 1.24 M unique users (estimate, within about 1 percent)', so nobody copies a dashboard number into a board deck by mistake.
| Use | Source | Why |
|---|---|---|
| Live product dashboards | Redis HyperLogLog | fresh, cheap, decision unchanged by 1% |
| Capacity planning | Redis HyperLogLog | trends and peaks, not exact totals |
| Billing and contracts | warehouse, exact | money depends on it, must be auditable |
| External or investor reporting | warehouse, exact | reproducible and defensible |
| Experiment analysis | warehouse, exact | small differences matter |
2Explaining the Mismatch
A Redis HyperLogLog has a standard error of 0.81 percent. That is one standard deviation, so about a third of estimates are further off than that, and an error of 1.6 to 2.4 percent happens now and then. On top of that, the two pipelines often differ in definitions: what counts as a user (logged-in only, or devices too), which time zone defines the day, bot filtering, and late-arriving events that the warehouse includes and the live counter missed.
So a 1 to 2 percent gap is expected, and we reconcile by method rather than by debugging: we document both definitions, check that they agree on what is counted, and show that the gap stays within the expected band over many days. If one day jumps to a 6 percent gap, that is worth investigating; a steady 1.5 percent is not.
3Answering the Privacy Request
A HyperLogLog cannot remove one user. It keeps only the maximum run of zeros per register, and we cannot know whether that user alone set any register. The structure also does not contain the user id, which matters for the legal analysis, but it was derived from personal data and could in principle be probed (adding an id and seeing whether the count changes can leak a little information).
The practical answer is to make the structures short-lived and rebuildable. If daily HyperLogLogs expire after, say, 30 days, and any longer-term figure is rebuilt from the event store or warehouse, which already processes deletions, then a deleted user disappears from all counts within a bounded time. For the request in hand, we delete the user's events at the source, rebuild any long-lived HyperLogLog that we keep, and record when the remaining short-lived ones expire.
How the stored registers are classified, whether they count as personal data and whether a bounded expiry satisfies the request, is a decision for privacy counsel, not for engineering. Our job is to give them accurate facts about what the structure contains and how fast it can be rebuilt.
4Making Approximate Structures a Documented Choice
Each approximate structure gets an entry in a short catalogue: its owner, what it estimates, its error bound, its TTL, the source it can be rebuilt from and how long a rebuild takes. That catalogue is what makes the privacy answer quick next time, and it stops approximate counts from quietly becoming the system of record.
New uses of approximate counting are reviewed against the policy table above. Most are approved in a minute; the review exists to catch the one that is about to drive an invoice.
- Does money, a contract or an external statement depend on it?YesExact warehouse countNoContinue
- Would a 2% error change the decision?YesExact warehouse countNoApproximate allowed
- Register it in the catalogueowner, error, TTL, rebuild source
- Label it in the interfaceestimate, within about 1%
4 steps in order. Play them, or step through them one at a time.
5Keeping the Cost Argument Visible
Approximate counting exists for a reason. Exact distinct counts in real time require remembering every id: tens of millions of ids per day in sets would cost gigabytes per metric per day, while a HyperLogLog costs 12 KB. Running exact distinct counts in the warehouse every minute would be expensive and slow. When someone asks 'why not make everything exact?', we show the cost of doing so for the dashboards that do not need it. Clarity about purpose is cheaper than either extreme.
6Follow-up questions
Would you ever show an approximate count to customers?
Yes, where precision does not matter to them and it is clearly presented, such as 'about 12,000 people viewed this post'. Rounded, labelled figures are honest and cheap. I would not show approximate numbers where customers make financial decisions, such as usage that drives their bill, or where they might compare two figures and read meaning into a 1 percent difference.
How do you stop people from copying dashboard numbers into reports?
Labelling helps, but making the exact number easy to get helps more. If the warehouse figure for last month is one click away, with a clear 'official' marker, people use it. The policy should also say which source is official for each reporting purpose.
What if finance wants live exact numbers?
We can provide them, at a cost: exact distinct counting with sets or streaming jobs keyed by user. I would ask what decision needs real-time exactness and show the infrastructure cost, and usually agree on a near-real-time exact figure every hour or day from the warehouse instead.
7Conclusion
In this answer, we set policy by purpose: approximate counts for live dashboards and capacity planning, exact warehouse counts for billing, contracts and external reporting, with approximate figures labelled. We explained the 1 to 2 percent mismatch as the expected result of a 0.81 percent standard error and differing definitions, and reconcile by method. Because a HyperLogLog cannot remove one user, we keep such structures short-lived and rebuildable from deletion-aware sources, with privacy counsel classifying the registers, and we document every approximate structure with an owner, error bound, TTL and rebuild source.
Open with
I'd set the policy around what each number is used for. Approximate counts from HyperLogLogs are fine for live dashboards and capacity planning, where a one or two percent error doesn't change any decision.
Then, if they want more
Billing, contracts, investor and external reporting use exact counts from the warehouse. Approximate figures are labelled in the interface, so nobody copies one into a board deck. The mismatch is expected, not a bug.
A Redis HyperLogLog has a 0.81 percent standard error, so gaps of one to two percent happen, and the two pipelines often differ in definitions like time zone or bot filtering. So we reconcile by method, document both definitions and only investigate if the gap leaves its normal band.
For the privacy request, a HyperLogLog can't remove one user, because registers only keep maximum values. So I'd delete the user's data at the source, rebuild any long-lived HyperLogLogs from data that already respects deletions, and keep the rest short-lived with TTLs so they age out within a known time.
Whether the registers count as personal data is for privacy counsel to decide; I give them the facts. Finally every approximate structure gets an owner, error bound, TTL and rebuild source in a catalogue, and I keep the cost argument visible: exact real-time distinct counts would cost far more.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Redis documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "As the senior technical leader, how do you set policy for where approximate counting is...": https://scrivio-interview-library.netlify.app/databases/redis-patterns/dff1c5184a/