Redis Hash Limits?

6,395 views
Skip to first unread message

Chris Johnson

unread,
Jan 25, 2012, 5:17:37 PM1/25/12
to redi...@googlegroups.com
Hi all.

To revisit the subject of Redis limits, what is the limit on:
(1) Number of hashes in redis?
(2) The number of fields within a given Redis hash?

I would imagine that each answer would be 2^32 (~4 billion), but I
wanted to verify.

As an aside, I wanted to share the nature of the data I'll be storing
in hashes, and I am hoping that if the hash structure is sub-optimal you
might be able to suggest an alternative:
>>
Hash Name:  "user_views:#{Date.today}:#{partner_id}" (planning on
about 5,000 different partner_ids)
Field: "#{user_id}" (planning about 10,000,000 user_ids, per partner)
Value: <a running total of views, modifying with hincrby>
>>

Cheers.
Chris

findchris

unread,
Jan 23, 2012, 6:26:49 PM1/23/12
to Redis DB
Hi all.

To revisit the subject of Redis limits, what is the limit on:
(1) Number of hashes in redis?
(2) The number of keys within a given Redis hash?

I would imagine that each answer would be 2^32 (~4 billion), but I
wanted to verify.

As an aside, I wanted to share the nature of the data I'll be storing
in hashes, and I hoping that if the hash structure is sub-optimal you
might be able to suggest an alternative:
Hash Name: "user_views:#{Date.today}:#{partner_id}" (planning on
about 5,000 different partner_ids)
Key: "#{user_id}" (planning about 10,000,000 user_ids, per partner)

findchris

unread,
Jan 24, 2012, 4:41:03 PM1/24/12
to Redis DB

findchris

unread,
Jan 30, 2012, 11:41:05 PM1/30/12
to Redis DB
So sorry about the triple post. Seems there was an issue with posting
to this group.

Salvatore Sanfilippo

unread,
Jan 31, 2012, 4:21:14 AM1/31/12
to redi...@googlegroups.com
On Tue, Jan 24, 2012 at 10:41 PM, findchris <find...@gmail.com> wrote:

> To revisit the subject of Redis limits, what is the limit on:
> (1) Number of hashes in redis?
> (2) The number of keys within a given Redis hash?

Hello, figures looking directly at the code:

1) Number of keys in every Redis database: 2^64-1 in 64 bit systems.
2^32-1 in 32 bit systems.
2) Number of hash fields in every hash: 2^64-1 in 64 bit systems.
2^32-1 in 32 bit systems.

Given that a 32 bit instance has at max 4GB of addressable space, the
limit is unreachable.
For 64 bit instances, given how big is 2^64-1, the limit is unreachable.

So for every practical point of view consider keys and hashes only
limited by the amount of RAM you have.

Salvatore

--
Salvatore 'antirez' Sanfilippo
open source developer - VMware

http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele

Reply all
Reply to author
Forward
0 new messages