--- acl_categories: - '@keyspace' - '@read' - '@fast' arity: 1 categories: - docs - develop - stack - oss - rs - rc - oss - kubernetes - clients command_flags: - readonly - fast complexity: O(1) description: Returns the number of keys in the database. group: server hidden: false hints: - request_policy:all_shards - response_policy:agg_sum linkTitle: DBSIZE railroad_diagram: /images/railroad/dbsize.svg since: 1.0.0 summary: Returns the number of keys in the database. syntax_fmt: DBSIZE title: DBSIZE --- {{< note >}} This command's behavior varies in clustered Redis environments. See the [multi-key operations]({{< relref "/develop/using-commands/multi-key-operations" >}}) page for more information. {{< /note >}} Return the number of keys in the currently-selected database. ## Redis Software and Redis Cloud compatibility | Redis
Software | Redis
Cloud | Notes | |:----------------------|:-----------------|:------| | ✅ Standard
✅ Active-Active | ✅ Standard
✅ Active-Active | | ## Return information {{< multitabs id="dbsize-return-info" tab1="RESP2" tab2="RESP3" >}} [Integer reply](../../develop/reference/protocol-spec#integers): the number of keys in the currently-selected database. -tab-sep- [Integer reply](../../develop/reference/protocol-spec#integers): the number of keys in the currently-selected database. {{< /multitabs >}}