Database schema for messaging to multiple users

后端 未结 2 1023
旧巷少年郎
旧巷少年郎 2021-02-06 19:55

I\'m looking for the best solution to implement messaging to multiple users within the system(Facebook-style).

I\'m came up with the following idea: where each Message

2条回答
  •  梦毁少年i
    2021-02-06 20:08

    The schema should work just fine as long as there aren't too many recipients of the same message. I don't see how you could make it much smaller or more efficient.

    The only performance problem I can see is that if you want to do broadcasting, that is, send the same message to a large group or, say, every user on the system. Sending such a message will be very slow (been there, done that). In that case, I would track the status of such global messages lazily, that is, create the status row for an individual user only after he has opened the message. But if you don't have such a feature planned, I'd say ignore this problem for now.

提交回复
热议问题