search

Home  >  Q&A  >  body text

Mysql database design - chat record table design

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࿆1776 days ago1720

reply all(2)I'll reply

  • 一锤一座山

    一锤一座山2020-04-22 11:09:07

    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
    0
  • Guanhui

    Great God

    Guanhui · 2020-05-04 11:29:02
  • Cancelreply