PFMERGE

Syntax

  1. PFMERGE destkey [sourcekey [sourcekey ...]]

Time complexity: O(N) to merge N HyperLogLogs, but with high constant times.

Merge multiple HyperLogLog values into a unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.

The computed merged HyperLogLog is set to the destination variable, which is created if does not exist (defaulting to an empty HyperLogLog).

If the destination variable exists, it is treated as one of the source sets and its cardinality will be included in the cardinality of the computed HyperLogLog.

Return

Simple string reply: The command just returns OK.

Examples

  1. dragonfly> PFADD hll1 foo bar zap a
  2. (integer) 1
  3. dragonfly> PFADD hll2 a b c foo
  4. (integer) 1
  5. dragonfly> PFMERGE hll3 hll1 hll2
  6. "OK"
  7. dragonfly> PFCOUNT hll3
  8. (integer) 6