Like facebook, everyone has messages on the wall. Are all messages stored in only one table? And it will only display messages belong to the user's ID when loading the page? And if it is then there will be so many rows in that table. Is there any开发者_如何学C limit of the rows in one table?
Or every user has one table only store their own messages?
Facebook's wall is not stored in MySQL at all as far as I know. They use Cassandra - a NoSQL database from Apache I think, and being NoSQL it uses entirely different philosophy than relative relational databases (like MySQL)
http://en.wikipedia.org/wiki/Apache_Cassandra
They use MySQL for other data though.
Also see similar question (answered) here:
Facebook wall's database structure
Or every user has one table only store their own messages?
That's not a good idea, you could end up with lots of tables. Lots of rows are better.
I would simply use a "table" that pairs message_id
with user_id
with proper indexes to quickly find messages attributed to a specific user.
Is there any limit of the rows in one table?
Quote from MySQL 5.1 Features:
Support for large databases. We use MySQL Server with databases that contain 50 million records. We also know of users who use MySQL Server with 200,000 tables and about 5,000,000,000 rows.
精彩评论