HOTKEYS
HOTKEYS TOP [count] HOTKEYS RESET
- Group
- Server
- Complexity
- O(N) where N is the number of keys tracked
- Arity
- -2 (at least 2 words, counting the command name)
- Flags
- admin, read-only
- HotKV Cloud
- All plans
- On-Premise
- no license needed
HOTKEYS shows which keys are accessed most, without scanning the keyspace
or sampling traffic yourself. Use it to find keys that concentrate load on
one node, or candidates for local caching. See hot keys
for ways to deal with them.
Tracking is off by default. Turn it on with hotkey-tracking yes, in the
config file or with CONFIG SET. While it is on, each
command that takes keys counts one access for its first key. The counts are
approximate.
Subcommands
Section titled “Subcommands”| Subcommand | Effect |
|---|---|
TOP [count] |
The count keys with the highest counts, highest first. count defaults to 10. |
RESET |
Forget all counts. |
Return value
Section titled “Return value”| Case | Reply (RESP2 and RESP3) |
|---|---|
TOP |
An array of [key, count] pairs (bulk string and integer). Empty while tracking is off or nothing has been counted. |
RESET |
Simple string OK |
count is negative or not an integer |
Error ERR value is not an integer or out of range |
| Unknown subcommand | Error ERR unknown subcommand '<name>'. Try HOTKEYS TOP [count], HOTKEYS RESET. |
Examples
Section titled “Examples”127.0.0.1:6379> CONFIG SET hotkey-tracking yesOK127.0.0.1:6379> HOTKEYS TOP 31) 1) "product:1001" 2) (integer) 482102) 1) "session:9f2c" 2) (integer) 120773) 1) "rate:api:203.0.113.7" 2) (integer) 9954127.0.0.1:6379> HOTKEYS RESETOKCompatibility
Section titled “Compatibility”HotKV-only command: Redis 7 and Valkey 8 have no HOTKEYS. (Newer Redis
versions add a HOTKEYS command with different subcommands, which HotKV
does not implement.) In Redis, redis-cli --hotkeys scans the keyspace
instead.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.