R
R
Roman Rakzin2016-09-28 14:36:03
MySQL
Roman Rakzin, 2016-09-28 14:36:03

How to properly organize the database structure for user messages?

The following message storage structure comes to mind

type Message struct{
        Id int `gorm:"primary_key"`
        UserFromId int `sql:"not null"`
        UserToId int `sql:"not null"`
        Created string `sql:"DEFAULT:current_timestamp"`
        Message string
    }

What will happen when there are a lot of messages and how will this affect the speed?
Base - PostgreSQL (Maybe Redis)
Server - Golang
**Which framework are you using?**

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2016-09-28
@FireGM

Sharding and partitioning!
Well, if you do not have a couple of tens of millions of messages, from which dozens of samples must be taken every second, then there is nothing to worry about.
And don't forget the cache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question