Most efficient database design for a blog (posts and comments)

后端 未结 5 2098
你的背包
你的背包 2021-01-31 12:15

What would be the best way of designing a database to store blog posts and comments? I am currently thinking one table for posts, and another for comments, each with a post ID.<

5条回答
  •  你的背包
    2021-01-31 12:46

    trawling through a large table of comments to find those for the relevant post would be expensive,

    An index is always there to rescue you! First index on postId and another of commentdate (desc)

提交回复
热议问题