Degenerate dimensions (退化的维)

本文介绍了一种特殊的数据仓库维度——退化维度的概念及其应用场景。退化维度是指那些过于简单以至于不值得创建单独维度表的维度,例如支付方式。文章通过具体实例展示了如何在Mondrian中实现退化维度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Degenerate dimensions (退化的维)不需要建立维度表,就用事实表的字段为维。
A degenerate dimension is a dimension which is so simple that it isn't worth creating its own
dimension table. For example, consider following the fact table:
product_id time_id payment_method customer_id store_id item_count dollars
55 20040106 Credit 123 22 3 $3.54
78 20040106 Cash 89 22 1 $20.00
199 20040107 ATM 3 22 2 $2.99
55 20040106 Cash 122 22 1 $1.18
- 24 -
and suppose we created a dimension table for the values in the payment_method column:
payment_method
Credit
Cash
ATM
This dimension table is fairly pointless. It only has 3 values, adds no additional information, and
incurs the cost of an extra join.
Instead, you can create a degenerate dimension. To do this, declare a dimension without a table,
and Mondrian will assume that the columns come from the fact table.
<Cube name="Checkout">
<!-- The fact table is always necessary. -->
<Table name="checkout">
<Dimension name="Payment method">
<Hierarchy hasAll="true">
<!-- No table element here.
Fact table is assumed. -->
<Level name="Payment method"
column="payment_method" uniqueMembers="true" />
</Hierarchy>
</Dimension>
<!-- other dimensions and measures -->
</Cube>
Note that because there is no join, the foreignKey attribute of Dimension is not necessary,
and the Hierarchy element has no <Table> child element or primaryKey attribute.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值