【问题标题】:mdx distinct count performancemdx 非重复计数性能
【发布时间】:2015-06-18 05:43:28
【问题描述】:

我得到一个像下面这样的 MDX 查询,它返回过去 30 天的平均不同计数,它返回正确的结果,但性能不好,在我的事实表中每天将有近 2,500,000 行数据。

WITH Member Measures.DailyAverageUser AS
    Avg ( EXISTING{[Date].[Date].[Date].Members},
                 [Measures].[Active Tiles Employee Id Distinct Count]
                ),format_String="##.000000"
             SELECT   Measures.DailyAverageUser ON 0,
            NON EMPTY([Action Targets].[Name].Children)  ON 1
            FROM [OLAP Pre]
            WHERE (
                {[Target Types].[Name].&[tile]},{[Employee Statuses].[Status Id].&      [1],[Employee Statuses].[Status Id].&[3],[Employee Statuses].[Status Id].&[4]},
            {[Business Region].[Abbreviation].&[NONE],[Business Region].[Abbreviation].&[AMS],[Business Region].[Abbreviation].&[APJ],[Business Region].[Abbreviation].&[EMEA]},{[Employee Types].[Bits].&[1],[Employee Types].[Bits].&[5],[Employee Types].[Bits].&[9],[Employee Types].[Bits].&[25],[Employee Types].[Bits].&[13],[Employee Types].[Bits].&[29]},{[Date].[Date Key].&[20150428]:null})

我把查询改成这个了,还是一样的问题,好在这个会缓存20150409:null之间的数据,用20150410:null查询的时候,会很快。

WITH Member Measures.DailyAverageUser AS
             Avg ( {[Date].[Date Key].&[20150409]:null},
                 [Measures].[Active Tiles Employee Id Distinct Count]
                ),format_String="##.000000"
             SELECT   Measures.DailyAverageUser ON 0,
            NON EMPTY([Action Targets].[Name].Children)  ON 1
            FROM [OLAP Pre]
            WHERE (
            {[Target Types].[Name].&[tile]},{[Employee Statuses].[Status Id].&[1],[Employee Statuses].[Status Id].&[3],[Employee Statuses].[Status Id].&[4]},
            {[Business Region].[Abbreviation].&[NONE],[Business Region].[Abbreviation].&[AMS],[Business Region].[Abbreviation].&[APJ],[Business Region].[Abbreviation].&[EMEA]},
            {[Employee Types].[Bits].&[1],[Employee Types].[Bits].&[5],[Employee Types].[Bits].&[9],[Employee Types].[Bits].&[25],[Employee Types].[Bits].&[13],
            [Employee Types].[Bits].&[29]})

需要关于性能的建议

【问题讨论】:

    标签: performance count distinct mdx


    【解决方案1】:

    您想将所有内容都保留在切片器轴上吗?如果没有,您可以像这样将所有内容都放入您成员的定义中 -

    WITH Member Measures.DailyAverageUser AS
                 Avg (           
                 NonEmpty(
                            (
                            {[Target Types].[Name].&[tile]},
                            {[Employee Statuses].[Status Id].&[1],
                             [Employee Statuses].[Status Id].&[3],
                             [Employee Statuses].[Status Id].&[4]},
                            {[Business Region].[Abbreviation].&[NONE],
                            [Business Region].[Abbreviation].&[AMS],
                            [Business Region].[Abbreviation].&[APJ],
                            [Business Region].[Abbreviation].&[EMEA]},
                            {[Employee Types].[Bits].&[1],
                            [Employee Types].[Bits].&[5]
                            ,[Employee Types].[Bits].&[9]
                            ,[Employee Types].[Bits].&[25]
                            ,[Employee Types].[Bits].&[13]
                            ,[Employee Types].[Bits].&[29]},
                            {[Date].[Date Key].&[20150428]:null}
                            ), [Measures].[Active Tiles Employee Id Distinct Count]
                        )            
                 ,
                     [Measures].[Active Tiles Employee Id Distinct Count]
                    ),format_String="##.000000"
    
    SELECT   Measures.DailyAverageUser ON 0,
    NON EMPTY([Action Targets].[Name].Children)  ON 1
    FROM [OLAP Pre]      
    

    【讨论】:

      【解决方案2】:

      不知道这是否也很慢?:

      SELECT   
        [Measures].[Active Tiles Employee Id Distinct Count] ON 0,
        NON EMPTY
        [Action Targets].[Name].Children  ON 1
      FROM [OLAP Pre];
      

      OLAP 可能会因大量不同的计数而变慢。

      【讨论】:

        猜你喜欢
        • 2014-03-17
        • 2012-06-08
        • 2021-09-26
        • 1970-01-01
        • 1970-01-01
        • 2019-02-04
        • 1970-01-01
        • 1970-01-01
        • 2021-06-09
        相关资源
        最近更新 更多