Hi! We use AS for a long time and now we stuck on implementing complex count query.
What we have:
- 260.000.000 of records (350Gb on SSD) with such bins: owner_id, end_date, message_type, is_read, message_params.
- 7.000.000 unique “owner_id” and secondary index on it.
- 3 nodes.
What we need:
- Few times per day we should put 1 “message” per owner_id and calculate count like: “SELECT COUNT(1), message_type FROM table WHERE owner_id= ‘some-owner-id’ AND end_date > NOW() AND is_read=0 GROUP BY message_type”
Right now for each owner_id we query all items with end_date > NOW() and do the rest “in code”. We do it in 200 threads so it leads to very hight IO Wait. In fact we read nearly all data.
So the question is how we can do that count operations without huge number of io reads. Maybe we can configure indexes in the way to do the “count” in memory. Like index on owner_id + end_date + is_read + message_type.
Have no idea… need help.