mdx独特的计数性能

时间:2015-06-03 06:44:42

标签: performance count distinct mdx

我得到了一个像下面这样的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]})

需要有关表现的建议

2 个答案:

答案 0 :(得分: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]      

答案 1 :(得分:0)

我想知道这是否也很慢?:

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

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