{
  "schema_version": 2,
  "id": "commands/select",
  "title": "SELECT",
  "url": "https://redis.io/docs/latest/commands/select/",
  "summary": "Changes the selected database.",
  "since": "1.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:21+01:00",
  "page_type": "content",
  "content_hash": "520b22ddcf70fa3d0249fdb0f2b62ea82c77ebe2a64b3b468229a1874354395f",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Select the logical Redis database having the specified zero-based numeric index.\nNew connections always use database zero.\n\nSelectable Redis databases are a form of namespacing: all databases are still persisted in the same RDB or AOF file. However, different databases can have keys with the same name, and commands like [`FLUSHDB`](https://redis.io/docs/latest/commands/flushdb), [`SWAPDB`](https://redis.io/docs/latest/commands/swapdb) or [`RANDOMKEY`](https://redis.io/docs/latest/commands/randomkey) work on specific databases.\n\nUse Redis databases to separate keys within the same application when needed. Don’t use them to run multiple unrelated applications in a single Redis instance.\n\nWhen using Redis Cluster, the `SELECT` command cannot be used, since Redis Cluster only supports database zero. Having multiple databases would be useless and an unnecessary source of complexity. Commands operating atomically on a single database would not be possible with the Redis Cluster's design and goals.\n\nSince the currently selected database is a property of the connection, clients should track the currently selected database and re-select it on reconnection. While there is no command in order to query the selected database in the current connection, the [`CLIENT LIST`](https://redis.io/docs/latest/commands/client-list) output shows, for each client, the currently selected database."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>index</code></summary>\n\nThe zero-based index of the database to switch to.\n\n</details>"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | Redis Software does not support shared databases due to potential negative performance impacts and blocks any related commands. The `SELECT` command is supported solely for compatibility with Redis Open Source but does not perform any operations in Redis Software. |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`.\n\n**RESP3:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`."
    }
  ],
  "examples": []
}
