SELECT

Since 1.1.0ServerChanged in 1.2.1

Syntax

SELECT index
  • Flags: fast
  • ACL categories: @connection, @fast
  • Arity: 2

History

  • 1.2.1: flags: removed write; acl categories: added connection; removed server, write

Makes database index the connection's current one. There are 16, 0 to 15, unless databases says otherwise; new connections start on 0. In a cluster only database 0 exists.

SELECT writes nothing, so, as in Redis, it runs past maxmemory, without enough replicas for min-replicas-to-write, and while writes are paused. Its ACL category is @connection, not @write: a user of +@read +@write needs +select (or +@connection) to change databases, and a user of +@all -@write may. Both are since 1.2.1; in 1.2.0, SELECT was refused or held as a write.

Reply

  • OK.
  • ERR DB index is out of range.

Examples

> SELECT 1
OK
> SELECT 16
(error) ERR DB index is out of range