设计维度层次结构:自然或非自然

发布于 2024-08-20 06:44:16 字数 1107 浏览 5 评论 0原文

我正在使用 Analysis Services,在设计维度时,我永远不确定要构建自然层次结构要走多远。

我的意思是我已经添加了所有真实的属性关系。因此,无论如何,大多数层次结构都是自然的,但最常请求的层次结构是 3 个或更多级别,其中中间级别作为缓慢变化的属性。

该场景正在跟踪作业。该作业有许多属性,这些属性都是静态的,但债务人属性(即谁支付发票)可以在作业过程中发生变化。因此,层次结构看起来像这样

 - Manager -> Debtor -> Job Name
 - Director -> Debtor -> Job Name 
 - Office -> Debtor -> Job Name 
 - Office -> Manager -> Debtor -> Job Name

因此,在维度内有许多层次结构,这些层次结构以作业的静态属性开始,然后是债务人(缓慢变化),作业名称(维度键)位于底部。

因此,我们目前要“自然化”这些层次结构所做的就是为出现在层次结构中的每个债务人创建“假”属性,该层次结构是其上方属性的组合。例如,对于上面的第一个示例,债务人级别属性将具有管理者和债务人 ID 的密钥。对于最后一个示例,经理级别将具有“经理”和“办公室”键,而“债务人”级别属性将具有“办公室”、“经理”和“办公室”键。债务人。然后我们隐藏所有这些属性,以便它们仅在层次结构中使用。

因此,这使我们的维度变得更加复杂,但我们确实获得了查询额外性能的好处。通常这是一个显着的改进。除了复杂性之外,我们还经常遇到问题,因为我们现在有多个版本的“债务人”,并且属性的关键不是债务人的 ID。因此,这会影响钻取和报告操作,并且如果我们想要更改某些级别的行为,也会使某些类型的计算变得更加困难。

我们使用的客户端是 Reporting Services、Excel 和 Office Web Components。

有人告诉我,在 SQL 2005 的早期版本中,涉及不自然层次结构的复杂查询可能会导致服务器完全陷入困境,这也是我们竭尽全力避免不自然层次结构的另一个原因。

此外,感叹号设计警告在 Visual Studio 中是如此引人注目,以至于拥有不自然的层次结构似乎是一件非常糟糕的事情。

其他设计师在这些情况下会做什么?你会在多大程度上避免不自然的等级制度?

I'm using Analysis Services and when designing dimensions I'm never sure how far to go to build natural hierarchies.

What I mean is I've added in all the genuine attribute relationships. So most hierarchies are natural anyway but the most commonly requested hierarchy is 3 or more levels with a middle level as a slowly changing attribute.

The scenario is tracking jobs. The job has many attributes which are all static but the Debtor attribute (i.e. who's paying the invoice) can change over the course of the job. So the hierarchies look like this

 - Manager -> Debtor -> Job Name
 - Director -> Debtor -> Job Name 
 - Office -> Debtor -> Job Name 
 - Office -> Manager -> Debtor -> Job Name

So within the dimension there are many hierarchies that start with static attribute(s) of the job followed by the debtor (which slowly changes) with the job name (dimension key) at the bottom.

So what we do at the moment to "naturalize" these hierarchies is create "fake" attributes for each debtor that appears in a hierarchy that is a combination of the attributes above it. e.g. for the first example above the Debtor level attribute would have a key of Manager and Debtor id's. And for the last example the Manager level would have a key of Manager and Office and the Debtor level attribute would have a key of Office, Manager & Debtor. We then hide all these attributes so they are only used in the hierarchies.

So this makes our dimensions a lot more complicated but we do get the benefit of extra performance on our queries. Often this is a noticeable improvement. Apart from complexity we constantly hit problems because we now have multiple versions of a "Debtor" and the key of the attribute is not the id of the debtor. So this affects Drillthrough and Reporting actions as well as making certain types of calculation more difficult if we want to change behavior for certain levels.

The clients we use are Reporting Services, Excel and Office Web Components.

I've been told that on early versions of SQL 2005 complex queries involving unnatural hierarchies could result in the server getting completely tied in knots which is another reason we've gone to great lengths to avoid unnatural hierarchies.

Also, the exclamation mark design warning is so dramatic in Visual Studio that it seems like a really bad thing to have unnatural hierarchies.

What do other designers do in these situations? How far do you go to avoid unnatural hierarchies?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海蓝天 2024-08-27 06:44:16

在 SSAS 多维数据集上缓慢变化的维度中进行层次结构的方法是合成一个伪层次结构,其中实际的键隐藏在幕后,但只是将属性显示为键一样。

Office     Manager    DebtorKey  Debtor      JobKey   Job Name    From        To
Scunthorpe Bloggs     101        Scarper&Co  2001     Fixit       2010-01-01  2010-01-31
Scunthorpe Bloggs     102        Bodgett     2002     Fixit       2010-02-01  9000-01-01

该层次结构是在原始缓慢变化的维度上构建的,并用于建立属性关系。您确实希望层次结构中的级别具有正确的属性关系。 IIRC 这些对于多维数据集进行“自动存在”优化(在命中事实表之前纯粹从维度解决非空性)是必要的 - 这就是为什么当未建立这些关系时多维数据集会很慢。

在构建多维数据集之前,您可能必须将层次结构应用于 SQL 中的维度。当然,如果您想加载更新,密钥将需要保持静态,但如果您有时间进行完全刷新,这可能没有必要。

The way to do hierarchies in a slowly changing dimension on a SSAS cube is to synthesize a pseudo-hierarchy with actual keys hidden behind the scenes but just showing the attributes as if they were keys.

Office     Manager    DebtorKey  Debtor      JobKey   Job Name    From        To
Scunthorpe Bloggs     101        Scarper&Co  2001     Fixit       2010-01-01  2010-01-31
Scunthorpe Bloggs     102        Bodgett     2002     Fixit       2010-02-01  9000-01-01

This hierarchy gets constructed over the original slowly changing dimension and is used to do the attribute relationships. You do want the levels in a hierarchy to have the proper attribute relationships. IIRC these are necessary for the cube to do the 'Autoexists' optimisation (resolve non-emptiness purely from the dimension before hitting the fact table) - which is why the cube is slow when these relationships are not set up.

You may have to apply the hierarchy to the dimension in SQL before constructing the cube. Certainly, if you want to load updates, the keys will need to remain static, although if you have time to do a complete refresh this may not be necessary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文