redis-cli DBSIZE

Category: Databases & SQL

redis-cli DBSIZE

Count keys in the selected database

Returns the number of keys in the currently selected database (index 0-15). Useful for spotting a database that is unexpectedly large or empty. For per-key-type breakdowns use INFO keyspace, and switch databases with redis-cli -n <index>.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.