What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

DBSIZE

Returns the number of keys in the database.

Usage
DBSIZE
Complexity
O(1)
Since
1.0.0
ACL Categories
@fast, @keyspace, @read
Command flags
READONLY, FAST

Return the number of keys in the currently-selected database.

Replies

RESP2

Integer reply: the number of keys in the currently-selected database.

RESP3

Integer reply: the number of keys in the currently-selected database.