Home Index

1. Redis

+ Concurrency

+ Redis Service

+ SHA256 Distribution

Redis /

How to use Redis Databases

Redis, has by default 16 databases identified by an integer. To increase Redis performance, we can use different database for different environments or workloads.

( eg.: DEV = database 0, QA = database 1, PROD = database 2 )

This way we will prevent to scan the entire Redis default database by switching between different databases, we need to use SELECT statement and DB integer.



Example: switch between different databases

redis> SELECT 0
redis> SELECT 1
redis> SELECT 2

Example: to flush DEV database from Redis Cluster and keeps other databases intact

redis> SELECT 0
redis> FLUSHDB