This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16118|Reply: 1

[Redis] How many keys can be stored in a redis instance, and what are the maximum keys and values?

[Copy link]
Posted on 1/24/2019 9:46:20 AM | | | |
Officially, a singleton can handle 250 million keys, and the maximum size of a key or value is 512M.

What is the maximum number of keys a single Redis instance can hold? and what the max number of elements in a Hash, List, Set, Sorted Set?
Redis can handle up to 232 keys, and was tested in practice to handle at least 250 million keys per instance.

Every hash, list, set, and sorted set, can hold 232 elements.

In other words your limit is likely the available memory in your system.



Reference links:https://redis.io/topics/faq






Previous:7-3 victory over the South Korean baseball team
Next:14 January Morning Post (Thursday)
 Landlord| Posted on 3/5/2019 5:14:33 PM |
The set type is also used to store multiple string elements, but unlike a list, its elements are unordered and unrepeatable, and the elements cannot be obtained through an index. As shown in the figure below, the set user:1:follows contains four elements: "his", "it", "sports", and "music", and a set can store up to (2 to the power of 32 - 1) elements.



1) Intra-collection operations
(1) Add element sadd key value [value...]  The return result is the number of elements that were successfully added.

(2) Delete the element srem key value [value...]  The return result is the number of elements that were successfully deleted.

(3) Get the number of elements scard key

(4) Determine whether the element is in the set of sismember key value

(5) Randomly return a specified number of elements from the set SrandMember Key [count] [count] is an optional parameter, if not written, the default is: 1.

(6) Randomly pop elements from the set spop key spop operation can randomly pop an element from the set.

(7) Get all elements of the set smembers key Get all elements of the collection, and the return result is out of order.

2) Operation between collections
(1) Find the intersection of multiple sets sinter key [key...]

(2) Find the union of multiple sets sunion key [key...]

(3) Find the difference set of multiple sets sdiff key [key...]

(4) Save the results of intersection, union and difference set.

sinterstore storeKey key [key...]
sunionstore storeKey key [key...]
sdiffstore storeKey key [key...]

The operation between sets will be more time-consuming when there are many elements, so redis provides the above three commands (original command + store) to save the results of intersection, union and difference sets between sets to storeKey, for example, save the intersection results between two collections of user:1:follows and user:2:follows to user:1_2:follows.



Resources:https://www.cnblogs.com/pirlo21/p/7120935.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com