维度 table 中的主键是否必须是事实 table 中的主键的一部分?
Does Primary key in Dimension table have to be part of the Primary key in the Fact table?
我们有一个Star schema,有一个非常大的Fact table,还有大约20个Dimension tables,当然来自Dimension Tables的PK必须是FK in the事实 table.
但是事实中的所有 FK Table 也需要成为 PK 的一部分吗?
我在几个 DWH 工作,但情况并非如此,但最近在一次大学考试中,我因为没有投入而得到了不好的成绩。
这是真的吗?这是一个好习惯吗?
如果我的事实 Table 有 20 个维度,那么对于这 30 个属性,事实 Table PK 是否必须是复合的?
这是一个很好的做法,因为它有助于确保您的所有事实都引用现有维度成员,并且可能会提高某些 DBMS because of indexing 的性能,但与任何其他 design/approach 一样,它不是强制性的。
事实表的组合键实际上是一种recommended practice by Kimball的维度建模方法,即因为:
In most environments this composite key will suffice as the primary
key to the fact table. There is typically no advantage of assigning a
surrogate key to the fact rows at a logical level because we have
already defined what makes a fact table row unique.
我们有一个Star schema,有一个非常大的Fact table,还有大约20个Dimension tables,当然来自Dimension Tables的PK必须是FK in the事实 table.
但是事实中的所有 FK Table 也需要成为 PK 的一部分吗?
我在几个 DWH 工作,但情况并非如此,但最近在一次大学考试中,我因为没有投入而得到了不好的成绩。
这是真的吗?这是一个好习惯吗?
如果我的事实 Table 有 20 个维度,那么对于这 30 个属性,事实 Table PK 是否必须是复合的?
这是一个很好的做法,因为它有助于确保您的所有事实都引用现有维度成员,并且可能会提高某些 DBMS because of indexing 的性能,但与任何其他 design/approach 一样,它不是强制性的。
事实表的组合键实际上是一种recommended practice by Kimball的维度建模方法,即因为:
In most environments this composite key will suffice as the primary key to the fact table. There is typically no advantage of assigning a surrogate key to the fact rows at a logical level because we have already defined what makes a fact table row unique.