I want to store info about some events in Cassandra. Events have different groups and also grouped by time interval (group id = partition key, interval = clustering key). Events has id and inside every group I want to store only events with unique id inside this group. I think to use sets for it and store event id in them. Something like this:
group id (PK) | time (CK) | event ids
1 | 13:00 | {0, 2, 4, 5}
1 | 14:00 | {1, 3}
1 | 15:00 | {}
2 | 13:00 | {}
2 | 14:00 | {2, 4}
When I do select request I want to get events count for special group inside some time range. It will be next for table above and group with id 1 for time range 13:00 - 15:00:
13:00 - 4
14:00 - 2
15:00 - 0
I can select all events sets for group 1 for time range 13:00 - 15:00 and calculate their side. It will works but events set can be large enough and I don't need info about event ids (I store it only for uniqueness), only their size. Can I get sets sizes on Cassandra side using CQL?