Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

PFDEBUG

Last updated
PFDEBUG GETREG key
PFDEBUG DECODE key
PFDEBUG ENCODING key
PFDEBUG TODENSE key
Group
HyperLogLog
Complexity
O(N) where N is the number of registers
Arity
3 (exactly, counting the command name)
Flags
write, admin
Keys
first 2, last 2, step 1
HotKV Cloud
All plans
On-Premise
no license needed

PFDEBUG is a diagnostic command for HyperLogLog values. A HyperLogLog starts in a compact sparse representation and switches to the fixed-size dense one as it fills up (the switch point is set with hll-sparse-max-bytes). PFDEBUG lets you see which one a key uses and its raw registers. It is an administrative command, meant for debugging rather than application code.

Subcommand Effect
GETREG Return the value of every register. Converts a sparse HyperLogLog to dense first.
DECODE Return a text description of a sparse HyperLogLog’s contents.
ENCODING Return sparse or dense.
TODENSE Convert to dense if the HyperLogLog is sparse.

The subcommand comes before the key and is not case-sensitive.

Subcommand RESP2 RESP3
GETREG Array of 16384 integers Array
DECODE Bulk string Bulk string
ENCODING Simple string sparse or dense Simple string
TODENSE Integer 1 if it was converted, 0 if it was already dense Integer

Errors:

  • ERR The specified key does not exist for a missing key.
  • ERR HLL encoding is not sparse for DECODE on a dense HyperLogLog.
  • ERR Unknown PFDEBUG subcommand '<name>' for an unknown subcommand.
  • The WRONGTYPE and INVALIDOBJ errors of PFADD.
127.0.0.1:6379> PFADD visitors alice bob carol
(integer) 1
127.0.0.1:6379> PFDEBUG ENCODING visitors
sparse
127.0.0.1:6379> PFDEBUG TODENSE visitors
(integer) 1
127.0.0.1:6379> PFDEBUG ENCODING visitors
dense
127.0.0.1:6379> PFCOUNT visitors
(integer) 3

Same subcommands and replies as Redis 7 and Valkey 8.

PFSELFTEST, PFADD, PFCOUNT