Redian新闻
>
A simple DB design question
avatar
A simple DB design question# Database - 数据库
m*i
1
现有一个table存放书籍,需要单独列出几本(<10)来推荐,每天更新。
问题:是专门用一个field来标记好呢,还是另外建一个table好呢?
avatar
a*t
2
don't really understand your question/requirement. for example, any
performance consideration?
but I'll try to answer
I think the logical deisgn would be to build a new table, and only store the
daily recoomendation list, with forigen key referrance to the main table.
if performance is an issue, I would actually copy the full contents of the
fields to the recommendation table
and do you need to keep track of the history of the "recommended"?

【在 m******i 的大作中提到】
: 现有一个table存放书籍,需要单独列出几本(<10)来推荐,每天更新。
: 问题:是专门用一个field来标记好呢,还是另外建一个table好呢?

avatar
d*l
3
Agree.

the

【在 a*******t 的大作中提到】
: don't really understand your question/requirement. for example, any
: performance consideration?
: but I'll try to answer
: I think the logical deisgn would be to build a new table, and only store the
: daily recoomendation list, with forigen key referrance to the main table.
: if performance is an issue, I would actually copy the full contents of the
: fields to the recommendation table
: and do you need to keep track of the history of the "recommended"?

avatar
x*e
4
Assail got your key.
No matter what you need, 专门用一个field来标记 won't be a good idea.
IF you want to do so, you can build a view for the recommended, and add the
column you want into the view.
You will keep the ref integraty and the performance in your mind.
Also, for the recommended history, in case you want, you want to use the
dimentional/fct model, the dimentional table will be your book table, and
keep the id with the history to build the transctional history fct table.

【在 m******i 的大作中提到】
: 现有一个table存放书籍,需要单独列出几本(<10)来推荐,每天更新。
: 问题:是专门用一个field来标记好呢,还是另外建一个table好呢?

avatar
q*1
5
你要的就是一个query,根本不需要什么新表和新的field。。

【在 m******i 的大作中提到】
: 现有一个table存放书籍,需要单独列出几本(<10)来推荐,每天更新。
: 问题:是专门用一个field来标记好呢,还是另外建一个table好呢?

avatar
t*g
6
Yes, cache the result in your application instead of database.

【在 q**1 的大作中提到】
: 你要的就是一个query,根本不需要什么新表和新的field。。
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。