Mysql database design - chat record table design
M࿆r.࿆z࿆h࿆a࿆n࿆g࿆
M࿆r.࿆z࿆h࿆a࿆n࿆g࿆ 2020-04-21 12:12:14
0
2
1565

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.? ?

M࿆r.࿆z࿆h࿆a࿆n࿆g࿆
M࿆r.࿆z࿆h࿆a࿆n࿆g࿆

reply all (1)
一锤一座山

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.

  • reply Great God
    Guanhui author 2020-05-04 11:29:02
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!