Merging distinct counts across regions
medium 4 minCompatible HyperLogLog sketches merge by taking the maximum for every corresponding register.
Video lesson · Chapter 1 of 5
One visitor crosses two regions
One traveller appears in both regions
1:11Reel
Theory
Read or listen first. About 1 min.
What it is
Two regions can sketch overlapping visitors independently. When both use compatible settings, each pair of corresponding registers describes the same part of the hash space.
Merge matching registers column by column
Why it exists
A per-register maximum keeps the strongest observation from either region. Common visitors contribute the same evidence they would have contributed to a single shared sketch.
Words to know
- Register-wise maximum
- A merge that keeps the larger stored rank at every matching register position.
How it works
Step through the idea, or press Play.
Record both visits. The same device is seen in two regions.
Understand it
Worked example
Merging distinct counts across regions in practice
A device visits two regions in one hour. Adding exact regional distinct counts counts it twice. In a merged sketch its repeated hash has the same address and rank, so the second observation adds no register information.
Related case
Three questions for a tiny memory budget
A telemetry service needs to skip pointless disk reads, estimate traffic for a known endpoint, and count unique devices across regions. Each question allows a different error.
Estimate the union of observed identities.