数据库——事实表和维度表

发布于 2025-01-07 03:23:14 字数 232 浏览 0 评论 0原文

在阅读一本关于业务对象的书时,我遇到了术语——事实表和维度表。这是所有数据库的标准做法,它们都有事实表和维度表,还是只是为了业务对象设计?我正在寻找一种解释来区分两者以及它们之间的关系。

编辑:

为什么查询不能从事实表中获取所需的数据?如果所有信息都单独存储在一张事实表中会发生什么?通过创建单独的事实和维度表并将其连接起来,我们可以获得什么优势?

抱歉一次问太多问题,但我想了解其中的相互关系和原因。

When reading a book for business objects, I came across the term- fact table and dimension table. Is this the standard thing for all the database that they all have fact table and dimension table or is it just for business object design? I am looking for an explanation which differentiates between two and how they are related.

Edited:

Why cannot a query just get the required data from the fact table? What happens if all the information are stored in one fact table alone? What advantages we get by creating a separate fact and dimension table and joining it?

Sorry for too many questions at a time but I would like to know about the inter-relations and whys.

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

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

发布评论

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

评论(2

一萌ing 2025-01-14 03:23:14

维度事实OLAP数据库设计中的关键术语。

  • 事实表包含可以聚合的数据。
  • 度量是聚合数据表达式(例如成本总和、调用计数……)
  • 维度包含用于生成组和过滤器的数据。
  • 没有维度数据的事实表是没有用的。示例:“订单总数为1M”不是信息,而是“2005年至2009年的订单总数”。

它们是许多使用这些概念的 BI 工具(例如 Microsft SSASTableau Software)和语言(例如 MDX)。

有时很难知道数据是度量还是维度。例如,我们正在分析收入,两种情况都是可能的:

  • 3个衡量标准净利润管理费用、< code>interest
  • 1 个度量利润1 个维度利润类型(包含 3 个元素:净额、间接费用、利息)

BI 分析师决定什么是每个解决方案的最佳设计。

已编辑,因为问题也在编辑中:

OLAP 解决方案通常具有语义层。该层向 OLAP 工具提供以下信息:哪些元素是事实数据、哪些元素是维度数据以及表关系。与 OLTP 系统不同,OLAP 数据库不需要正确规范化。因此,您可以从包括事实表在内的多个表中获取维度数据。从事实表中获取数据的维度名为事实维度退化维度

在设计 OLAP 数据库时,您应该牢记许多概念:“星型模式”、“雪花模式”、“代理键”、“父子层次结构”……

Dimension and Fact are key terms in OLAP database design.

  • Fact table contains data that can be aggregate.
  • Measures are aggregated data expressions (e. Sum of costs, Count of calls, ...)
  • Dimension contains data that is use to generate groups and filters.
  • Fact table without dimension data is useless. A sample: "the sum of orders is 1M" is not information but "the sum of orders from 2005 to 2009" it is.

They are a lot of BI tools that work with these concepts (e.g. Microsft SSAS, Tableau Software) and languages (e. MDX).

Some times is not easy to know if a data is a measure or a dimension. For example, we are analyzing revenue, both scenarios are possibles:

  • 3 measures: net profit , overheads , interest
  • 1 measure: profit and 1 dimension: profit type (with 3 elements: net, overhead, interest )

The BI analyst is who determines what is the best design for each solution.

EDITED due to the question also being edited:

An OLAP solution usually has a semantic layer. This layer provides to the OLAP tool information about: which elements are fact data, which elements are dimension data and the table relationships. Unlike OLTP systems, it is not required that an OLAP database is properly normalized. For this reason, you can take dimension data from several tables including fact tables. A dimension that takes data from a fact table is named Fact Dimension or Degenerate dimension.

They are a lot of concepts that you should keep in mind when designing OLAP databases: "STAR Schema", "SNOWFLAKE Schema", "Surrogate keys", "parent-child hierarchies", ...

寂寞花火° 2025-01-14 03:23:14

这是数据仓库中拥有事实表和维度表的标准。事实表包含您正在测量的数据,例如您正在求和的数据。维度表是包含您不希望在事实表中不断重复的数据的表,例如产品数据、状态、客户等。它们通过键关联:在星型模式中,事实表中的每一行包含维度表中一行的键。

That's a standard in a datawarehouse to have fact tables and dimension tables. A fact table contains the data that you are measuring, for instance what you are summing. A dimension table is a table containing data that you don't want to constantly repeat in the fact table, for example, product data, statuses, customers etc. They are related by keys: in a star schema, each row in the fact table contains a the key of a row in the dimension table.

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