简体   繁体   English

事实表设计以及在多个事实表中出现的度量

[英]Fact table design with measures that occur in multiple fact tables

I'm working on a star-schema and trying to find a best practise for the database design. 我正在研究一个星型架构,并试图找到数据库设计的最佳实践。

I have three (at this moment) dimension tables for several facts. 我有三个(目前)维度表,以了解多个事实。 Most of the facts look-a-like (meaning they're a different type of fact, but share characteristics). 大多数事实看起来像(意味着它们是不同类型的事实,但具有共同特征)。 While the shared measures don't belong in the dimension tables (since they're not facts, but results to a logical test/condition at a specific moment) I'm wondering what the best practise is for this situation. 尽管共享度量不属于维表(因为它们不是事实,而是在特定时刻导致逻辑测试/条件的结果),但我想知道这种情况的最佳实践是什么。

  1. Do all the fact tables have the 'shared' measures 所有事实表都具有“共享”措施吗
  2. Would/could some sort of fact snow-flake fact structure arise (with the query performance issues it will bring) 是否会出现某种事实的雪花事实结构(伴随它带来的查询性能问题)

Looking forward to your insights and argumentation on the subject. 期待您对这个问题的见解和争论。

A bit too vague, but here are a few options: 有点含糊,但是这里有一些选择:

1) if all facts have the same granularity and measures, consider keeping them all in the same fact table, together with a fact type dimension; 1)如果所有事实具有相同的粒度和度量,请考虑将它们连同事实类型维一起保存在同一事实表中;

2) Join the various fact tables via virtual cubes. 2)通过虚拟立方体连接各种事实表。 Most OLAP tools should allow for such a construction (eg, Mondrian does) 大多数OLAP工具都应允许这种构造(例如Mondrian这样做)

3) If the various fact tables have the same granularity but different measures then they can still be combined, but having each type of fact contribute with a different set of fact table columns (instead of just rows) 3)如果各种事实表具有相同的粒度但度量不同,则它们仍可以合并,但是让每种类型的事实都具有一组不同的事实表列(而不只是行)

4) If neither of the above is possible (different granularities, for example), you may need to re-combine them at the coarser grain level (with aggregation) or at the finer grain level (with some allocation algorithm), to analyze them together. 4)如果以上两种方法均不可行(例如,不同的粒度),则可能需要在较粗粒度级别(使用聚集)或较细粒度级别(使用某种分配算法)重新组合它们以进行分析一起。

5) If this is still not possible, you may want to combine not the fact tables themselves, but the query results at the report/dashboard level, combining just the aggregated results instead of the atomic database rows. 5)如果仍然无法做到这一点,则可能不希望合并事实表本身,而是合并报告/仪表板级别的查询结果,仅合并汇总结果而不是原子数据库行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM