I have a model “Messages” which I use to store messages throughout the site. These are messages in discussions, private messages and probably chat. They are all stored in one table. I wonder if it will be faster if I spread messages among several models and tables. One for chat, one for discussions and so on.
So should I keep all messages in one table/model or create several identical models/tables?
As long as you have an index on your
typecolumn and filter on that, it will be about the same speed. When your table gets really big, just shard on thetypecolumn and it will be the same performance as doing multiple tables but your app will just see one big table.