antirez/redis — Issue #299: SORT: allow nested hash lookups with GET and BY
Author: zr40
Created: 2012-01-16 11:40:36+00:00
State: open

I'm storing foos and bars (both hashes), with each foo pointing to a bar. To get bar fields from a list of foos, I would `SORT foo GET foo:*->bar` and then do O(N) HGETs. (N being the number of items.)

The O(N) HGETs could be removed if it were possible to do something like `SORT foo GET bar:{foo:*->bar}->field`.

A workaround would be to store bar's field in foo and using `SORT foo GET foo:*->bar_field`, but that would require adding O(M) HSETs when updating bar's field. (M being the number of hashes pointing to the hash being written.) It would also require more memory to store the field in each foo.

Being able to nest hash lookups would remove the O(N) HGETs without adding O(M) HSETs.