博客最有效的数据库设计(帖子和评论) [英] Most efficient database design for a blog (posts and comments)

查看:301
本文介绍了博客最有效的数据库设计(帖子和评论)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设计数据库来存储博客文章和评论的最佳方式是什么?我目前想要一个表格的帖子,另一个用于评论,每个都有一个帖子ID。

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.

然而,在我看来,找到那些相关的帖子将是昂贵的,并会在每次加载一个博客文章(可能有一些数量的缓存)。

It seems to me, however, trawling through a large table of comments to find those for the relevant post would be expensive, and would be done every time a blog post is loaded (perhaps with some amount of caching).

有更好的方法

推荐答案


然而,在我看来, >

It seems to me, however, trawling through a large table of comments

所有数据库供应商都同意。

All the database vendors agree with you.

他们提供索引这个。

这篇关于博客最有效的数据库设计(帖子和评论)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆