Redis - HyperLogLog Pfcount Command


Advertisements

Redis PFCOUNT command is used to get the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable. If the key does not exist, then it returns 0.

Return Value

Integer reply, approximated number of unique elements.

When PFCOUNT command is used with multiple keys, then it returns approximated cardinality of the union of the HyperLogLogs.

Syntax

Following is the basic syntax of Redis PFCOUNT command.

redis 127.0.0.1:6379> PFCOUNT KEY1 KEY@... KEYN 

Example

redis 127.0.0.1:6379> PFADD mykey a b c d e f g h i j 
(integer) 1 
redis 127.0.0.1:6379> PFCOUNT mykey 
(integer) 10 
redis 127.0.0.1:6379> PFCOUNT mykey 
(integer) 10 
redis 127.0.0.1:6379> PFCOUNT mykey mynewkey 
(integer) 10
redis_hyperloglog.htm
Advertisements