We're building an analytics service. One of our needs is to maintain ~100MM sets each with anywhere between one member to 1MM members, with each member represented as a long. We need to be able to very quickly:
-Add a member to a set, and know whether it was added
-Update a counter indicating the size of the set
We have a realtime processing loop that ingests new data and needs to be able to update some number of the sets as well as its counter.
At the moment, we have this implemented in PostgreSQL, distributed application side by set name. There's one table with two columns: the set name in the first and the value in the second, as well as an index on set name, value. Is there a better method than this? AFAIK it's not a problem with a standard solution.