如何更改关于连接表的mondrian配置

时间:2014-10-22 09:22:37

标签: performance mdx query-performance mondrian

我有如下查询:

with member 
  [Measures].[ASD] as 
    'Count(
       Filter(
         [DId].[DId].Members
         , [Measures].[X] >=2000000000
       )
     )'
select
  [Branch].[City].Members on axis(0),
  [Measures].[ASD] on axis(1)
from [D];

对于mondrian,需要花费大量时间才能运行 - 大约40秒。 这是因为它正在查询每个城市,如下所示:

[[DId].[DId]]: executing sql [select "D"."D_Id" as "c0" from "XXX"."D" "DId", "XXX"."BRANCH" "BRANCH" where "D"."FD_BRANCH" = "BRANCH"."BRANCH_ID" and "BRANCH"."CITY_ID" = 111 group by "D"."D_Id" having (sum("D"."X") >= 2000000000) order by "D"."D_Id" ASC NULLS LAST]

如果你用SQL语言编写并在例如oracle中运行它只需要1秒。 我想知道mondrian中是否有任何配置说不要这样查询并以正式方式查询?

1 个答案:

答案 0 :(得分:0)

COUNT(FILTER应该避免。

这有希望更快地运行:

with member 
  [Measures].[ASD] as 
    'Sum(
       [DId].[DId], //<<maybe this should read [DId].[DId].[DId]? 
       Iif([Measures].[X] >=2000000000,1,NULL)
     )'
select
  [Branch].[City].Members on axis(0),
  [Measures].[ASD] on axis(1)
from [D];

Mosha在此解释:http://sqlblog.com/blogs/mosha/archive/2007/11/22/optimizing-count-filter-expressions-in-mdx.aspx