how to structure these columns in redis
I am new to redis and having a bit of a hard time seeing how to store these columns
- By Item number get the top 10 CompanyCode based on highest score
- By CompanyCode get the top 10 ItemNumbers based on highest score
I am thinking this should be solvable by sorted sets but having a hard time with the permutations
- CompanyCode (1) for this ItemNumber (A) has .89 Score
- CompanyCode (1) for this ItemNumber (B) has .40 Score
- CompanyCode (2) for this ItemNumber (A) has .91 Score
How should I structure this?
EDIT 1: If a sorted list per CompanyCode with the ItemNumber and score seems exactly what a sorted set is for but i have 30k+ CompanyCodes so that is a ton of Sets.
EDIT 2: I am thinking this could be solved by
Sorted set per CompanyCode so CompanyCode:ItemCode and Score
Sorted set per ItemCode so ItemCode:CompanyCode Score
Would result in 30-40k Sorted Sets for CompanyCode and ~25k sorted sets for ItemCode