存储聚合数据是否违反数据库规范化? [英] Does storing aggregated data go against database normalization?

查看:135
本文介绍了存储聚合数据是否违反数据库规范化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在诸如SO这样的网站上,我确信绝对有必要存储尽可能多的汇总数据,以避免在每次页面加载时执行所有这些复杂的查询/计算。例如,存储每个问题/答案的投票计数的连续计数,或者存储每个问题的答案数量,或查看问题的次数,这样就不必经常执行这些查询。

On sites like SO, I'm sure it's absolutely necessary to store as much aggregated data as possible to avoid performing all those complex queries/calculations on every page load. For instance, storing a running tally of the vote count for each question/answer, or storing the number of answers for each question, or the number of times a question has been viewed so that these queries don't need to be performed as often.

但是这样做违反数据库规范化或任何其他标准/最佳实践吗?最好的方法是什么,例如,每个表都应该有另一个汇总数据表,是否应该将其存储在它代表的同一表中,何时应该更新汇总数据?

But does doing this go against db normalization, or any other standards/best-practices? And what is the best way to do this, e.g., should every table have another table for aggregated data, should it be stored in the same table it represents, when should the aggregated data be updated?

谢谢

推荐答案

存储聚合数据本身并不违反任何标准格式。由于功能依赖性,多值依赖性和联接依赖性,归一化仅与冗余有关。它不处理任何其他类型的冗余。

Storing aggregated data is not itself a violation of any Normal Form. Normalization is concerned only with redundancies due to functional dependencies, multi-valued dependencies and join dependencies. It doesn't deal with any other kinds of redundancy.

这篇关于存储聚合数据是否违反数据库规范化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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