我们有一个数据仓库,它有两个维度,Product 和 ProductLine。Product 只有一个条目,并且只有一个 ProductLine 的描述从transport更改为Transport。当从源数据创建星型模式时,是否应该将产品和产品线组合到一个产品维度?
+-------------+-------------+-------------+------------------------+------------+------------+
| Product | | | | | |
+-------------+-------------+-------------+------------------------+------------+------------+
| SurrogateID | BusinessKey | Description | ProductLineBusinessKey | ValidFrom | ValidTo |
+-------------+-------------+-------------+------------------------+------------+------------+
| 1 | 100 | Car | 10 | 01.01.1900 | 31.12.9999 |
+-------------+-------------+-------------+------------------------+------------+------------+
+-------------+-------------+-------------+------------+------------+
| ProductLine | | | | |
+-------------+-------------+-------------+------------+------------+
| SurrogateID | BusinessKey | Description | ValidFrom | ValidTo |
+-------------+-------------+-------------+------------+------------+
| 1 | 10 | transport | 01.01.1900 | 15.10.2016 |
+-------------+-------------+-------------+------------+------------+
| 2 | 10 | Transport | 16.10.2016 | 31.12.9999 |
+-------------+-------------+-------------+------------+------------+
A)包含产品和产品线的产品的一维表?
+-------------+--------------------+------------------------+-------------+-----------------+------------+------------+
| DimProduct | | | | | | |
+-------------+--------------------+------------------------+-------------+-----------------+------------+------------+
| SurrogateId | BusinessKeyProduct | BusinessKeyProducsLine | DescProduct | DescProductLine | ValidFrom | ValidTo |
+-------------+--------------------+------------------------+-------------+-----------------+------------+------------+
| 1 | 100 | 10 | Car | transport | 01.01.1900 | 15.10.2016 |
+-------------+--------------------+------------------------+-------------+-----------------+------------+------------+
| 2 | 100 | 10 | Car | Transport | 16.10.2016 | 31.12.9999 |
+-------------+--------------------+------------------------+-------------+-----------------+------------+------------+
+-----------------------+--------------------+----------------+
| FactTable | | |
+-----------------------+--------------------+----------------+
| SurrogateIdDimProduct | SurrogateIdDimDate | MeasureSalesPc |
+-----------------------+--------------------+----------------+
| 1 | 20161014 | 100 |
+-----------------------+--------------------+----------------+
| 2 | 20161016 | 150 |
+-----------------------+--------------------+----------------+
B) product 和 product line 的二维表?
+-------------+--------------------+-------------+------------+------------+
| DimProduct | | | | |
+-------------+--------------------+-------------+------------+------------+
| SurrogateId | BusinessKeyProduct | DescProduct | ValidFrom | ValidTo |
+-------------+--------------------+-------------+------------+------------+
| 1 | 100 | Car | 01.01.1900 | 31.12.9999 |
+-------------+--------------------+-------------+------------+------------+
+----------------+-------------+-------------+------------+------------+
| DimProductLine | | | | |
+----------------+-------------+-------------+------------+------------+
| SurrogateID | BusinessKey | Description | ValidFrom | ValidTo |
+----------------+-------------+-------------+------------+------------+
| 1 | 10 | transport | 01.01.1900 | 15.10.2016 |
+----------------+-------------+-------------+------------+------------+
| 2 | 10 | Transport | 16.10.2016 | 31.12.9999 |
+----------------+-------------+-------------+------------+------------+
+-----------------------+----------------+--------------------+----------------+
| FactTable | | | |
+-----------------------+----------------+--------------------+----------------+
| SurrogateIdDimProduct | DimProductLine | SurrogateIdDimDate | MeasureSalesPc |
+-----------------------+----------------+--------------------+----------------+
| 1 | 1 | 20161014 | 100 |
+-----------------------+----------------+--------------------+----------------+
| 1 | 2 | 20161016 | 150 |
+-----------------------+----------------+--------------------+----------------+
应如何设计适用于此场景的数据集市星型模式?显然,解决方案 A 的优点是只需要一个连接,而 B 导致产品维度中的条目较少。如果有很多产品,维度可能会快速增长。还有其他的考虑吗?什么是最佳实践?
对不起丑陋的“桌子”。