PFDEBUG
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.
Options
Section titled “Options”| 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.
Return value
Section titled “Return value”| 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 existfor a missing key.ERR HLL encoding is not sparseforDECODEon a dense HyperLogLog.ERR Unknown PFDEBUG subcommand '<name>'for an unknown subcommand.- The
WRONGTYPEandINVALIDOBJerrors of PFADD.
Examples
Section titled “Examples”127.0.0.1:6379> PFADD visitors alice bob carol(integer) 1127.0.0.1:6379> PFDEBUG ENCODING visitorssparse127.0.0.1:6379> PFDEBUG TODENSE visitors(integer) 1127.0.0.1:6379> PFDEBUG ENCODING visitorsdense127.0.0.1:6379> PFCOUNT visitors(integer) 3Compatibility
Section titled “Compatibility”Same subcommands and replies as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.