w3resource

Redis Server: DBSIZE

Redis DBSIZE Command

Redis DBSIZE command is used to return the number of keys in selected database.

Here are some common uses and scenarios for the "DBSIZE" command:

  • Key Count: Returns the number of keys in the currently selected database.
  • Database Monitoring: Useful for monitoring the size of a Redis database and understanding data volume.
  • Resource Management: Assists in managing resources by providing insights into the amount of data stored.
  • Performance Analysis: Helps in performance analysis by providing information on how many keys are being handled by the database.
  • Maintenance Planning: Aids in planning maintenance activities or optimizations based on the number of keys in the database.

Syntax:

DBSIZE

Available since

1.0.0.

Return Value

Integer reply.

Return Value Type

Integer

Example: Redis DBSIZE

redis 127.0.0.1:6379> DBSIZE 
(integer) 147

Previous: CONFIG RESETSTAT
Next: DEBUG OBJECT



Follow us on Facebook and Twitter for latest update.