Feature Request: Support unions and intersections of sets together #444

Closed
RajivKurian opened this Issue Apr 9, 2012 · 1 comment

Projects

None yet

1 participant

@RajivKurian

To emulate something like MySQL And / Or conditions - I build indexes using sets and sorted sets. But I can only do intersections and unions but not combine them. To do both intersections and unions, I have to factor them out into unions and intersections and combine in the application code.
For eg if I was to find out (A U B) U (C ∩ D) I have to:

  1. Perform (A U B) through sunion and (C ∩ D) using sinter and
  2. Compute a union in my application code.

I could have stored the intermediate results in redis through sunionstore and sinterstore and then done a sunion using the intermediate results but for simple gets storing intermediate sets and then cleaning them up is kind of messy, especially with multiple threads. I guess when LUA scripting comes in I would not have to pay the price of having all this data flow back to my application layer, but it seems like a general syntax to support unions and intersections together would be useful.

Also I would find performing unions/ intersections combining results of zrevrange, zrange etc very useful. For example (zrange key1 max1 min1) U (zrevrange key2 max2 min2). Storing these results in intermediate sets and then deleting them later seems kind of messy/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment