Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any number limitations of field for Redis command HMSET?

Tags:

redis

What's the max number limitation of field for Redis command HMSET ? If I set 100000 fields to one key by HMSET , if would cause the performance issue comparing to use the each field as a key?

like image 880
Jason Avatar asked Sep 01 '16 07:09

Jason


People also ask

What is Hmset in Redis?

Redis HMSET command is used to set the specified fields to their respective values in the hash stored at the key. This command overwrites any existing fields in the hash. If the key does not exist, a new key holding a hash is created.

Is Hmset deprecated?

HMSET (deprecated)As of Redis version 4.0. 0, this command is regarded as deprecated. It can be replaced by HSET with multiple field-value pairs when migrating or writing new code.

Does Redis allow duplicate keys?

You can use the DUMP and RESTORE commands to duplicate the key: use the DUMP command to serialize the value of a key. use the RESTORE command to restore the serialized value to another key.


1 Answers

it is quite large, 2^64-1 in 64 bit systems, and 2^32 -1 in 32 bit systems, https://groups.google.com/d/msg/redis-db/eArHCH9kHKA/UFFRkp0iQ4UJ

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

like image 123
DhruvPathak Avatar answered Oct 19 '22 16:10

DhruvPathak