Spaceship222
Spaceship222

Reputation: 849

Redis: single big hash vs many keys

I have some data which has million key-value pairs. So which way is better to store them in redis, single key with super big hash which has million key-value pairs or million keys each having a value?

In my opinion, both ways seems not very good given million pairs.

Any suggestion?

Upvotes: 2

Views: 1082

Answers (1)

Guy Royse
Guy Royse

Reputation: 4312

Redis stores everything in a big hash table internally anyhow. So for a single node, probably not going to make a big difference.

However, as soon as you need to scale and add clustering, that one key that contains your hash and that has everything will always be on the same shard. Which means clustering isn't really doing anything.

I'd go for the proliferation of keys.

Upvotes: 3

Related Questions