什么时候用雪花模型

时间:2021-04-14 18:57:13

什么时候使用雪花模型?

Ralph Kimball,数据仓库大师,讲述了三个例子。对于三个例子,使用雪花模型不仅仅是可接受的,而且是可能是一个成功设计的关键。

1,一个用户维度表且数据量较大。其中,80%的事实度量表是匿名访问者,仅包含少数详细信息。20%的是可靠的注册用户,且这些注册用户有较为详细的信息,与多个维度表中的数据相连。

2,例如一个金融产品维度表,且这些金融产品有银行类的,保险类等等区别。
因此不同种类的产品有自己一系列的特殊属性,且这些属性并非是所有产品共享的。

3,多个企业共用的日历维度表。但每个企业的财政周期不同,节假日不同等等。


In snowflake schema, you further normalize the dimensions. Ex: a typical Date Dim in a star schema can further be normalized by storing Quarter Dim, Year dim in separate dimensions. 

Snowflake schema is generally used if:

1) You have a requirement where you don't need to frequently query a certain set of dimension data but still need it for information purposes. By storing this data in a separate dimension,  you are reducing redundancy in main dimensions.

2) You have a reporting or cube architecture that needs hierarchies or slicing feature. 

3) You have fact tables that have different level of granularity . Ex: You have sales fact table where you are tracking sales at product level. Then you also have budget fact table where you are tracking budgeting by product category. 



补充一条, 在数据仓库的环境中用雪花模型,降低储存的空间,到了具体某个主题的数据集市再用星型模型。