如题,方案一为:
table comment{
id,
user,
publish_time,
……,
content
}
方案二为:
table comment{
id,
user,
publish_time,
……
}
table comment_content{
id,
comment_id,
content
}
如题,方案一为:
table comment{
id,
user,
publish_time,
……,
content
}
方案二为:
table comment{
id,
user,
publish_time,
……
}
table comment_content{
id,
comment_id,
content
}
|
swullingFeb 7, 2020
1
正常不都是方案一么。
|
|
JmmBiteFeb 7, 2020
2
量小方案一,量大剥离出来方案二
|
|
keepeyeFeb 7, 2020
3
不管怎么样 开始最好用方案一 不要过度优化
|
|
opengpsFeb 7, 2020
4
字段位置移动性质,建议后期再垂直拆分
|
|
akiraFeb 7, 2020
5
方案 1.
如果是走方案 2 的话,那你可以把帖子和回复的内容都放一起了 |
|
gzlockFeb 7, 2020 via Android
6
方案三,主帖表用 JSON 字段放回复楼层数据
|
|
sadfQED2Feb 7, 2020
9
方案二适合数据量大的情况,把索引字段和内容数据分开,这样方便做分表,并且不至于大量数据冗余。我们公司目前百亿级别评论数据,comment 表有 2 份,一份 uid 分表,一份文章 id 分表,所有查询走 comment,取到评论 id 再去 comment_content 表查内容。但是这样做以后表基本上不能改字段了,如果业务变动会非常麻烦,所以后期我们花了非常大的精力做迁移,将数据忘 nosql 上同步
方案一的话开发方便,业务变动的时候加字段方便。 |