星型模式设计

编程入门 行业动态 更新时间:2024-10-27 23:26:19
本文介绍了星型模式设计-一栏尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是数据仓库的新手,但我认为我的问题相对容易回答. 我建立了一个星型模式,其中包含一个尺寸表"product".该表具有列"PropertyName"和列"PropertyValue". 因此,维度看起来像这样:

I`m new to data warehousing, but I think my question can be relatively easy answered. I built a star schema, with a dimension table 'product'. This table has a column 'PropertyName' and a column 'PropertyValue'. The dimension therefore looks a little like this:

surrogate_key | natural_key (productID) | PropertyName | PropertyValue | ... 1 5 Size 20 ... 2 5 Color red 3 6 Size 20 4 6 Material wood

以此类推.

在我的事实表中,我总是使用尺寸的替代键.造成PropertyName和PropertyValue列的原因,我的自然键不再唯一/无法标识,因此事实表中的行太多了.

In my fact table I always use the surrogate keys of the dimensions. Cause of the PropertyName and PropertyValue columns my natural key isn`t unique / identifying anymore, so I get way too much rows in my fact table.

我现在的问题是,我应该如何处理属性列?最好将每个属性放到单独的维度中,例如维度大小,维度颜色等?我有大约30种不同的属性. 还是应该为事实表中的每个属性创建列? 还是将所有属性一维化?

My question now is, what should I do with the property columns? Would it be best, to put each property into separate dimensions, like dimension size, dimension color and so on? I got about 30 different properties. Or shall I create columns for each property in the fact table? Or make one dimension with all properties?

在此先感谢您的帮助.

推荐答案

您的尺寸表产品"应如下所示:

Your dimension table 'product' should look like this:

surrogate_key | natural_key (productID) | Color | Material | Size | ... 1 5 red wood 20 ... 2 6 red ...

如果必须具有多个属性,请尝试将它们归入另一个维度.例如,如果您可以在另一种颜色或材料中使用相同的ID和相同的价格购买相同的产品,则颜色和材料可以是另一维的属性.您的事实表可以使用两个键来标识产品:product_id和colormaterial_id ...

If you have to many properties, try to group them in another dimension. For example Color and Material can be attributes of another dimension if you can have the same product with same id and same price in another color or material. Your fact table can identify product with two keys: product_id and colormaterial_id...

阅读建议: 数据仓库工具包,Ralph Kimball

更多推荐

星型模式设计

本文发布于:2023-10-14 19:03:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1491932.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!