|
SortCommand
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
► Sign in to add a comment
|
Search
|
|
SortCommand
We moved to Redis.io!Redis home moved to http://redis.io, please visit our new home. |
What is the time complexity of SORT?
if can support SORT SINTER key1 key2 key3 . redis will can make a search engine.
We already heave a {weight} in sorted lists, so it whould be nice to have a sorting by {weight} from sorted lists, for example: SORT mylist BYSCORE weight
multiple by would be lovely (blush)
@tongxiaojun, already exists with a little cleverness
1. SINTERSTORE tmp_key key1 key2 key3... (also SDIFFSTORE and SUNIONSTORE)
2. SORT tmp_key BY ... GET ...
3. DEL tmp_key
I think it will be userful to add "SORT key RANDOM" option to get N random and non-repeating values from SET.
it would be useful to sort on fixed properties of an external key , i'm thinking of cardinality
who_owns_cars_list : bob john matt jack jill
jill_cars : porsche matt_cars: audi ford chevy jack_cars: toyota ford
who owns the most cars?
SORT who_owns_cars list BY cardinality ( cars )
thanks !
LOVE redis btw
oops my star disappeared - that was of course SORT who_owns_cars list BY cardinality (<STAR>cars )
I may be doing this wrong but here is my scenario, I have a list of timestamps:
and a list of values in a hash with associated timestamps:
Now I understand that I can use BY/GET and reference keys using the *, however, would it be possible that it could be implemented to use fields (within hashes) aswell. So I could implement:
sort time_list by nosort GET value->`*`
So that all of the values which I sort through in the list "time_list" will then be referenced against the fields found within the hash and then GET the results. I know that I could simply use normal key-value pairs however, I was hoping I could take advantage of the nicely coupled hashes, if anyone has any other ideas then please let me know.
"Note that GET can be used multiple times"
This doesn't appear to be the case when using the -> syntax for hash fields.
Sorting on shrded weight keys would be nice!
"With SORT BY you need that all the weight keys are in the same Redis instance of the list/set you are trying to sort"
This limits my sharding strategy. Would be nice to be able using the key tags for sorting over sharded weight keys that are not necessarily stored on the same Redis instance of the list
Can the "get" operator access other databases? (usually switched to with "select")