Performance of Sorted Sets in Redis

Time Complexity of Sorted Sets operations is generally O(log(N)), where N is the number of members, but be careful while using the ZRANGE command with large number of return values because the time complexity of this command is O(log(N) + M), where M is the number of results returned by the command



Complete tutorial on Sorted Sets in Redis

Sorted sets are sets with some additional functionalities that is they can be sorted in some ways, allowing more control over the data that is stored in sets. Sorted sets maintain an ordered collection of unique elements, associated with scores (unique no).

Some of the best use cases of it are making a leaderboard, ranking systems, etc. Its actual Data structure is a combination of a list and hash table having characteristics of both sets and sorted lists. These sorted sets contain a unique score that allows the elements to be sorted in ascending or descending order.

Similar Reads

Syntax and Commands of Redis Sorted Sets

1. “zadd” command:...

Performance of Sorted Sets in Redis:

Time Complexity of Sorted Sets operations is generally O(log(N)), where N is the number of members, but be careful while using the ZRANGE command with large number of return values because the time complexity of this command is O(log(N) + M), where M is the number of results returned by the command...

Contact Us