Search code examples
phpmysqldatabase-design

store posts + comments in mysql dbs


I am working on a social/community site and I am confused about how to store posts and comments.

If I store post with an post_id, post_creator, time, post/text, privacy in a table post14 then how would I store comments(+commentator) of this post?

Notice I may have 10,000 users each average posts 10 mean 1 million post_id.

Is this good idea to create a table for each post_id and store comments? Or is there a better alternative?


Solution

  • it' horrible to create a table for each post. you can create 3 tables as user, posts, and comments and link them by foreign key constrain.