we are using cassandra to store chat data. we have to maintain all the users conversations and sort them based on the messages received.
Conversation: Is a stream of messages between 2 or more users. Conversations does not have an endtime and are continuous.
We are maintaining a table which has "user to conversations" based on the conversation create time. But we would like to sort it based on the messages received.
Solutions
- Solution -1:
I have looked at a similar question Cassandra: List 10 most recently modified records
which suggests to use materialized view. Is this approach fine for frequently updated records like messages.
- Solution -2: Use another table to maintain user_recentconversations in a list. Update the list with when the messages are received/sent to/by the user.
Considering the usecase please suggest what would be better solution.