sorting - Redis Sorted Set Member Size and Performance -


redis sorted sets sort based on score; however, in cases multiple members share same score lexicographical (alpha) sorting used. redis zadd documentation indicates function complexity is:

"o(log(n)) n number of elements in sorted set"

i have assume remains true regardless of member size/length; however, have case there 4 scores resulting in members being sorted lexicographically after score.

i want prepend time bases key each member have secondary sort time based , add uniqueness members. like:

"time-based-key:member-string" 

my member-string can larger javascript object literals so:

json.stringify( {/* object literal */} ) 

will sorted set zadd , other functionality's performance remain constant?

if not, magnitude performance affected?

the complexity comes number of elements need tested (compared against new element) find correct insertion point (presumably using binary search algorithm).

it says nothing how long take perform each test, because that's considered constant factor (in sense doesn't vary when add more items).

the amount of data needs compared before determining new element should go before or after existing 1 affect total clock time, each comparison equally.

so overall clock time insert quickest when comparing scores only, , progressively slower deeper pair of strings has determine lexical order. won't particular magnitude, though, concrete number of microseconds multiplied log(n) complexity factor.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -