Question

Given a large sorted set with rapidly changing scores/weights, what's the most efficient way to maintain subsets and access those subsets in the master set's order?

Was it helpful?

Solution

You have a couple of options for this:

  • Update scores in the superset and when you need to read the subset call ZINTERSTORE with subset weighting set to 0 so the result is the subset with scores from the superset.
  • When updating the scores, write to the subsets as well as the superset.

The most appropriate option will depend on what you need to optimise for - read, write, memory or simplicity. How the subsets are determined and the size of the sets relative to the number of updates may also have an impact.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top