CLUSTER COUNTKEYSINSLOT

CLUSTER COUNTKEYSINSLOT slot
Available since:
Redis Open Source 3.0.0
Time complexity:
O(1)
ACL categories:
@slow,
Compatibility:
Redis Software and Redis Cloud compatibility

Returns the number of keys in the specified Redis Cluster hash slot. 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.

Note:
During atomic slot migration operations (available since Redis 8.4.0), keys being imported or trimmed will be filtered out from the results.

Required arguments

slot

The hash slot to count the keys in.

Examples

> CLUSTER COUNTKEYSINSLOT 7000
(integer) 50341

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
❌ Standard
❌ Active-Active
❌ Standard
❌ Active-Active

Return information

Integer reply: The number of keys in the specified hash slot, or an error if the hash slot is invalid.
RATE THIS PAGE
Back to top ↑