Question

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?

Was it helpful?

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.

OTHER TIPS

You have to create 3 tables

  1. Users
  2. Posts
  3. Comments

So in Post, you will have a column user_id which will be coming from table Users. In your comments you will have post_id which will be related to table Post. This way its all fully manageable and if you have 10000 users nothing to worry I guess...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top