PFCOUNT
PFCOUNT is a Redis command that returns the approximate cardinality of the union of HyperLogLog structures stored at one or more keys. A HyperLogLog is a probabilistic data structure used to estimate the number of distinct elements in a set while using a fixed, small amount of memory. PFCOUNT takes one or more keys as arguments and computes an estimate of the total number of distinct elements across the provided HyperLogLogs. If a key does not exist, it is treated as an empty HyperLogLog; if all keys are non-existent, PFCOUNT returns 0.
The command is commonly used for analytics on large data streams where exact counting would be expensive.
PFCOUNT is often used in conjunction with PFADD to insert elements into HyperLogLog structures and with PFMERGE
Examples: PFADD hll1 a b c; PFCOUNT hll1 returns an estimate around 3. PFCOUNT hll1 hll2 yields