PFMERGE
PFMERGE destkey [sourcekey [sourcekey ...]]
- Group
- HyperLogLog
- Complexity
- O(N) for N source keys
- Arity
- -2 (at least 2 words, counting the command name)
- Flags
- write
- Keys
- first 1, last final argument, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
PFMERGE combines the source HyperLogLogs into destkey, so that its
estimate covers every element seen by any of them. If destkey already holds
a HyperLogLog, it is part of the union too; otherwise it is created. Missing
sources are skipped. With no sources, PFMERGE just makes sure destkey
exists as a HyperLogLog. The destination keeps its time to live.
In a cluster, all keys must hash to the same slot.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Simple string OK |
Simple string OK |
The errors are those of PFADD, for the destination or any source.
Examples
Section titled “Examples”127.0.0.1:6379> PFADD day:1 alice bob carol(integer) 1127.0.0.1:6379> PFADD day:2 carol dave(integer) 1127.0.0.1:6379> PFMERGE week day:1 day:2OK127.0.0.1:6379> PFCOUNT week(integer) 4Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.