Can I have multiple databases on my Redis DB / Getting "ERR invalid DB index"

The Redis Labs Team -

Redis currently supports the shared (i.e., numbered) databases functionality. Having shared databases means that the same Redis instance manages multiple databases. Each of these databases has its own key space.

Because Redis is (mostly) single-threaded, shared databases can and do interfere with each other because one blocking/resource-heavy command executed in one shared database effectively freezes all others as well. Shared databases are great for development and perhaps even for staging purposes, but should not be used in production. The `KEYS` command, for example, is a good example of a resource-intensive command that should be used with caution (i.e., not in production).

That is exactly the reason why each of our Redis Cloud instances allows using just one database (the default, 0-numbered database). This ensures that any two databases in our service will never compete on the resources of a single thread. In fact, trying to use any database other than 0 with our service should produce an error.

To use these dedicated instance, simply add databases to your subscription by clicking the Add DB link from the console. Each dedicated database is provisioned with its own endpoint that you can be used to connect to.

On the same topic, you may want to review the following post from our blog that discusses this with an illustrative benchmark.

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk