我有两个相同的查询。一个使用.CHILDREN
检索成员,而其他人使用.MEMBERS
。它们被应用于自然层次结构。我一直发现.MEMBERS通常比.CHILDREN
更快地返回结果(有时快得多)。以下是我发现的MDX工作室的查询,消息和perfmon摘录具有最大差异。
查询1(使用.MEMBERS)
with set abc as
[Accident Cause].[Accident Cause Code].members
member measures.bcd as
sum(existing abc, [Measures].[Claim As Of - Count])
select {[Measures].[Claim As Of - Count], measures.bcd} on 0,
[Accident Cause].[Accident Cause Code].members on 1
from [aw cube]
--5 seconds
执行查询... 获取类型的对象:Microsoft.AnalysisServices.AdomdClient.CellSet 格式化。 单元格集由1126行和3列组成。 完成格式化。 执行完成
NON EMPTYs : 0
Autoexists : 0
EXISTINGs : 1125
SE queries : 0
Flat cache insert : 2
Cache hits : 0
Cache misses : 0
Cache inserts : 0
Cache lookups : 0
Memory Usage KB : 4992
查询2(使用.CHILDREN)
with set abc as
[Accident Cause].[Accident Cause Code].children
member measures.bcd as
sum(existing abc, [Measures].[Claim As Of - Count])
select {[Measures].[Claim As Of - Count], measures.bcd} on 0,
[Accident Cause].[Accident Cause Code].children on 1
from [aw cube]
执行查询... 获取类型的对象:Microsoft.AnalysisServices.AdomdClient.CellSet 格式化。 单元格集由1125行和3列组成。 完成格式化。 执行完成
NON EMPTYs : 0
Autoexists : 0
EXISTINGs : 1124
SE queries : 0
Flat cache insert : 1124
Cache hits : 0
Cache misses : 0
Cache inserts : 0
Cache lookups : 0
Memory Usage KB : 3744
--41 seconds
虽然我知道这些功能之间的概念差异,但我不明白为什么性能可能会有这么大的变化。
编辑 - 冒险作品的结果
with set abc as
[Geography].[City].members
member measures.bcd as
sum(existing abc,[Measures].[Internet Sales Amount])
select {[Measures].[Internet Sales Amount], measures.bcd} on 0,
[Geography].[City].members on 1
from [Adventure Works]
/*
Time : 503 ms
Calc covers : 0
Cells calculated : 2938
Sonar subcubes : 1186
NON EMPTYs : 0
Autoexists : 0
EXISTINGs : 588
SE queries : 2
Flat cache insert : 1
Cache hits : 1180
Cache misses : 0
Cache inserts : 0
Cache lookups : 1180
Memory Usage KB : 0
*/
with set abc as
[Geography].[City].children
member measures.bcd as
sum(existing abc,[Measures].[Internet Sales Amount])
select {[Measures].[Internet Sales Amount], measures.bcd} on 0,
[Geography].[City].children on 1
from [Adventure Works]
/*
Time : 843 ms
Calc covers : 0
Cells calculated : 1174
Sonar subcubes : 589
NON EMPTYs : 0
Autoexists : 0
EXISTINGs : 587
SE queries : 588
Flat cache insert : 0
Cache hits : 1176
Cache misses : 0
Cache inserts : 0
Cache lookups : 1176
Memory Usage KB : 28912
*/