【发布时间】: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