Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7040803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:57:42+00:00 2026-05-28T01:57:42+00:00

I am using redis with multiple databases (which I switch by the SELECT command).

  • 0

I am using redis with multiple databases (which I switch by the SELECT command).

I am storing different types of information into redis and I needed to seperate it somehow. I didn’t like to prefix the keys to distniguish the information type so I created more databases.

I would like to ask if it was a right decission, with concern for performance ?

Also how much overhead does SELECT cause ? If I need to traverse some related data from say two databases, which aproach is better (see pseudo code) ?

for data in array {
  redis_select(0)
  k = redis_get(...)
  redis_select(1)
  k2 = redis_get(k)
}

or

redis_select(0)
k = []
for data in array {
  k[x] = redis_get(...)
}

redis_select(1)
k2 = []
for data in array {
  k2[x] = redis_get(k[x])
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:57:43+00:00Added an answer on May 28, 2026 at 1:57 am

    You can use the Redis database concept to separate data. This is fully supported in the current version, and will still be supported in the future ones.

    Now, this is not the recommended solution to isolate data. It is better to run several Redis instances instead. The overhead of an instance is very low (less than 1 MB), so you can start several of them on any box. It is more scalable (the workload will be distributed on several CPU cores instead of just one). It is more flexible (you may want to use different configuration parameters per data set, or different dump files). Your client just has to open one connection per instance to access the various data sets.

    Now if you still want to use Redis databases, and are concerned with performance, you need to evaluate the number of extra roundtrips they represent. With in-memory databases such as Redis, the cost of all basic operations is almost the same, because it is dominated by communication and protocol management, not by the execution itself. So when the keys/values are small, GET, SET, SELECT commands tend to have the same cost. Each time a SELECT is executed, it is just like if an extra GET or SET command is executed.

    Taking your examples, the first proposal will generate 4 commands per item of the array. The second proposal will generate only 2 commands per item, so it is much more efficient. If the number of items is significant, the cost of SELECT is negligible in the second proposal, while it is not in the first one.

    If you plan to iterate on arrays to run Redis commands, consider using variadic parameters commands (such as MGET/MSET) or pipelining (if your client support it), in order to reduce the general number of roundtrips.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using redis-rb, how can I push a hash into a list? Do I have
I am using Redis to store two databases : 0 and 1 via the
I am using Redis database where we store the navigational information. These data must
I unsuccessfully tried using txredis (the non blocking twisted api for redis) for a
I am using Redis 2.4.6 Stable. I have increased the number of redis file
I am using redis and node (with node_redis ) and I would like to
I'm using redis with php (predis at http://github.com/nrk/predis/ ) and am experiencing frequent timeout.
Anyone had success with using Redis as Beaker backend? Can you tell me link
How can I implement an autocomplete using redis? Say for example I have an
I am new to Redis (using it at a hosted service) and want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.