What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.
CLUSTER COUNTKEYSINSLOT
Returns the number of keys in a hash slot.
Usage
CLUSTER COUNTKEYSINSLOT slot
Complexity
O(1)
Since
3.0.0
ACL Categories
@slow
Command flags
STALE
Returns the number of keys in the specified Valkey Cluster hash slot in the
currently selected database. The command only queries the local data set,
so contacting a node that is not serving the specified hash slot will always
result in a count of zero being returned.
> CLUSTER COUNTKEYSINSLOT 7000
(integer) 50341
Replies
RESP2
Integer reply: The number of keys in the specified hash slot, or an error if the hash slot is invalid.
RESP3
Integer reply: The number of keys in the specified hash slot, or an error if the hash slot is invalid.