Skip to main content
Use PFMERGE to merge several HyperLogLogs into a single one. The destination ends up representing the union of the source structures and of whatever it already held, so merging the same sources again changes nothing and new data can be folded in as it arrives. The destination is created if it does not exist. Because the union is computed register by register and loses no accuracy compared with counting the raw data, rolling hourly keys into a daily key, or daily keys into a monthly one, gives the same estimate as if every element had been added to that key directly. That makes PFMERGE the building block for time-based rollups of unique counts.

Syntax

Arguments

Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

Related topics

PFCOUNT