优化蒙德里安的集合计算

时间:2016-02-01 20:37:45

标签: mdx mondrian rolap

我有一个MDX查询,我正在Mondrian engin上执行它。

WITH 
  MEMBER [Measures].[HC Threshold] AS 
    Val(StrToMember("[HC Threshold].[HC Threshold].[All].[25000]").Name) 
   ,FORMAT_STRING = "$#,0" 
  SET ClaimantsSet AS 
    Order
    (
      Filter
      (
        NonEmpty
        (
          [Count Of Claimants].[Count Of Claimants].[ID].MEMBERS
         ,{[Measures].[Plan Paid]}
        )
       ,
        [Measures].[Plan Paid] > [Measures].[HC Threshold]
      )
     ,[Measures].[Plan Paid]
     ,desc
    ) 
  MEMBER [Measures].[ICD9Desc] AS 
    Tail
    (
      Order
      (
        NonEmpty
        (
          [ICD-9 Primary Diagnosis Code].[Diagnosis Code].[ID].MEMBERS
         ,{[Measures].[Plan Paid]}
        )
       ,[Measures].[Plan Paid]
       ,asc
      )
    ).Item(0).Item(0).Properties("Short Description") 
SELECT 
  {[Measures].[ICD9Desc]} ON 0
 ,NON EMPTY 
    {ClaimantsSet} ON 1
FROM [Combined Claims]
WHERE 
  (
    [Insights Group Structure].[Insights Group Structure].[Insights Report ID].&[1706].FirstChild
    /* StrToMember("No HRA",CONSTRAINED), */
   ,[Plan Period].[Plan Period].[Date Year Quart].&[20152].Lead(4)
   ,[Claim Status].[Claim Status].[Claim Status ID].&[1]
  );

当我执行它时,由于超时而失败。

但是当我执行时,

WITH 
  MEMBER [Measures].[HC Threshold] AS 
    Val(StrToMember("[HC Threshold].[HC Threshold].[All].[25000]").Name) 
   ,FORMAT_STRING = "$#,0" 
  SET ClaimantsSet AS 
    Order
    (
      Filter
      (
        NonEmpty
        (
          [Count Of Claimants].[Count Of Claimants].[ID].MEMBERS
         ,{[Measures].[Plan Paid]}
        )
       ,
        [Measures].[Plan Paid] > [Measures].[HC Threshold]
      )
     ,[Measures].[Plan Paid]
     ,desc
    ) 
SELECT 
  NON EMPTY 
    {ClaimantsSet} ON 0
FROM [Combined Claims]
WHERE 
  (
    [Insights Group Structure].[Insights Group Structure].[Insights Report ID].&[1706].FirstChild
    /* StrToMember("No HRA",CONSTRAINED), */
   ,[Plan Period].[Plan Period].[Date Year Quart].&[20152].Lead(4)
   ,[Claim Status].[Claim Status].[Claim Status ID].&[1]
  );

仅在列上设置,它在3分钟内成功运行。

当我查找第一个查询的SQL日志时,我发现,正在为set'ClaimantSet'的每个元组计算ICD9Desc值,所以如果set claimantSet中有300个元组,则ICD9Desc计算得到300次,所以生成了300个SQL查询。因此,需要时间和时间。

是否有任何解决方案可以避免多次生成SQL查询,我可以在Mondrian中优化我的MDX查询或Schema吗?

1 个答案:

答案 0 :(得分:0)

如果你从订单中取出订单,你仍然可以获得相同的功能并且运行得更快吗?

{{1}}