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.

HOTKEYS

Last updated
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.

Subcommand Effect
TOP [count] The count keys with the highest counts, highest first. count defaults to 10.
RESET Forget all counts.
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.
127.0.0.1:6379> CONFIG SET hotkey-tracking yes
OK
127.0.0.1:6379> HOTKEYS TOP 3
1) 1) "product:1001"
2) (integer) 48210
2) 1) "session:9f2c"
2) (integer) 12077
3) 1) "rate:api:203.0.113.7"
2) (integer) 9954
127.0.0.1:6379> HOTKEYS RESET
OK

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.

OBJECT FREQ, MONITOR, hot keys