I would like to ask all the experts, how do you design the chat database? Those who have experience can talk about their experience, and those who have no experience can discuss it together.
Current problems encountered:
Assume
There are 1,000 people in the group chat, and user a sends a message:
Then:
Plan A: Insert a record corresponding to 1,000 people in the group chat (required Insert 1000 records, very scary)
Plan B: Insert a record (the user has read it, how can the user delete a record? Add a corresponding relationship table??)
Others Solution: Use other storage methods, such as Redis, memecache, etc.? ?
Memcached stores, and gives a mark to record the amount of data currently saved. When the number of pieces of data is satisfied, it will be inserted into MYSQL uniformly, return the success status, and clear the data saved by Memcached.