为了报告而对实时数据进行非规范化 - 好还是坏?

发布于 2024-08-12 03:54:22 字数 151 浏览 4 评论 0原文

对企业应用程序数据库进行非规范化的优点/缺点是什么,因为它将使编写报告变得更容易?

Pro - 在 SSRS 中设计报告可能会“更容易”,因为不需要连接。

由于数据重复和同步,开发/维护应用程序来处理非规范化数据将变得更加困难。

其他的?

What are the pros/cons of de-normalizing an enterprise application database because it will make writing reports easier?

Pro - designing reports in SSRS will probably be "easier" since no joins will be necessary.

Con - developing/maintaining the app to handle de-normalized data will become more difficult due to duplication of data and synchronization.

Others?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

烟燃烟灭 2024-08-19 03:54:22

为了报告而进行非规范化是不好的,好吧。

创建视图或非规范化数据仓库都很好。

视图解决了我大部分与报告相关的需求。当用户几乎不断地生成报告或者当您的视图开始变慢时,数据仓库就非常有用。

这就是为什么你想要标准化你的数据库

  1. 使关系集合免于不需要的插入、更新和删除依赖性;
  2. 减少引入新类型数据时重组关系集合的需要,从而延长应用程序的生命周期;
  3. 使关系模型为用户提供更多信息;
  4. 使关系集合对查询统计数据保持中立,这些统计数据可能会随着时间的推移而发生变化。

—EF Codd,“数据库关系模型的进一步规范化”,来自 wikipedia

Denormalization for the sake of reports is Bad, m'kay.

Creating views, or a denormalized data warehouse is good.

Views have solved most of my reporting related needs. Data warehouses are great when users will be generating reports almost constantly or when your views start to slow down.

This is why you want to normalize your database

  1. To free the collection of relations from undesirable insertion, update and deletion dependencies;
  2. To reduce the need for restructuring the collection of relations as new types of data are introduced, and thus increase the life span of application programs;
  3. To make the relational model more informative to users;
  4. To make the collection of relations neutral to the query statistics, where these statistics are liable to change as time goes by.

—E.F. Codd, "Further Normalization of the Data Base Relational Model" via wikipedia

绮筵 2024-08-19 03:54:22

您应该考虑反规范化的唯一时间是生成报告所需的时间不可接受的时候。反规范化会导致一致性问题,有时无法确定,尤其是在大型数据集中

The only time you should consider de-normaliozation is when the time it takes the report to generate is not acceptable. De-normalization will cause consistentcy issues that are sometimes impossible to determine especially in large datasets

掩耳倾听 2024-08-19 03:54:22

不要仅仅为了消除报告的复杂性而进行非规范化,它可能会导致应用程序的其余部分出现巨大问题。要么您不强制执行导致错误数据的规则,要么如果您这样做,则每个人(而不仅仅是运行报表的两三个人)的插入、删除和更新都会严重减慢。

如果报告确实无法正常运行,则创建一个非规范化的数据仓库,并在每晚或每周的提要中填充它。通常需要此功能的报告类型通常不关心数据是否是最新的,因为它们通常是月度、季度或年度报告,会在事后处理(尤其是汇总)大量数据。

Don't denormalize just to get rid of complexity in reporting, it can cause huge problems in the rest of the application. Either you don't enforce the rules resulting in bad data or if you do then inserts, deletes and updates can be seriously slowed for everyone not just the two or three people who run reports.

If the reports truly can't run well, then create a data warehouse that is denormalized and populate it in a nightly or weekly feed. The kind of reports that typically need this do not generally care if the data is up-to-the minute as they are usually monthly, quarterly, or annual reports that process (and especially aggregate) large amounts of data after the fact.

瑾兮 2024-08-19 03:54:22

您可以同时执行这两项操作...让应用程序标准化数据库。
然后为报告创建一个非规范化数据库,并创建一个定期将数据从一个数据库复制到另一个数据库的应用程序。

毕竟,报告并不总是需要拥有最新更新的数据,大多数时候您可以轻松地每 1 小时在报告数据库上启动一次更新,而且每天只需一次。

You can do both... let the normalized database for applications.
Then create a denormalized database for reports, and create an application which regulary copy data from one database to the other.

After all, reports don't always need to have the latest updated data, most of the time you can easily launch an update every 1 hour on the reporting database, and only once a day day.

冬天旳寂寞 2024-08-19 03:54:22

除了其他答案中提供的数据仓库和视图解决方案(在某些方面都很好)之外,如果您愿意牺牲一些性能来获得最后一秒的数据,但仍然想要一个规范化的数据库,您可以在 Oracle 上使用在提交时具有快速刷新的物化视图,或者在 Sql Server 中,您可以对视图使用聚集索引。

Beyond the data warehouse and views solutions provided in other answers, which are good in some ways, if you are willing to sacrifice some performance to get a good to the last second data, but still want a normalized database, you could use on Oracle a Materialized View with fast refresh on commit, or in Sql Server, you could use clustered indexes for a view.

埖埖迣鎅 2024-08-19 03:54:22

另一个缺点是数据可能不是实时的,因为数据从标准化形式转变为非标准化形式需要一些时间。如果有人希望报告及时更新到被请求的那一刻,在这种情况下可能很难做到。

如果这是原始帖子中同步的重复,抱歉我不太这么认为。

Another Con is that the data is likely not to be real-time as there is some time moving around the data to go from a normalized form to a de-normalized. If someone wants the report to be up to the very second it was requested, that can be tough to do in this situation.

If this is a duplication of the synchronization in the original post, sorry I didn't quite see it that way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文