`
housheng33
  • 浏览: 238602 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Degenerate dimensions (退化的维)

    博客分类:
  • BI
阅读更多

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.

0
10
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics