Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

MDX ordering very slow

$
0
0

Hi,

I am testing a Tabular database with a third party component front end that emits MDX queries.  I have learnt some DAX but I don't know MDX.  I have come across a query that takes 31ms to run but jumps to 12 seconds when I add sorting.  (Despite only returning 3 rows!)  The equivalent DAX runs in 16ms, sorted or otherwise.

I've added both MDX queries below.  I'm hoping somebody can spot something obviously wrong with the sorting.

Many thanks,

Michael

Fast, unsorted

select
non empty 
{ 
	[Measures].[Total ITD PnL], 
	[Measures].[Total Commitment], 
	[Measures].[Percent Hedge]
}  on columns,
non empty 
{ 
	nonempty
	(
		crossjoin
		(
			{ 
				( 
					[Sub Group Hedges].[Sub Group].&[SubGroup1], 
					[Sub Group Hedges].[Position Hedge].&[Hedge] 
				)
			} ,
			{
				{
					[Security].[SecurityDesc].[SecurityDesc].members
				}
			}
		),
		{
			[Measures].[Total ITD PnL], 
			[Measures].[Total Commitment], 
			[Measures].[Percent Hedge]
		}
	)
} 
dimension properties MEMBER_UNIQUE_NAME,MEMBER_TYPE,MEMBER_VALUE  on rows
from [Model]

Slow, sorted

with
member [Measures].[XtraPivotGrid -728462353 Sort] as '[Security].[SecurityDesc].currentmember.member_value' 
select
non empty 
{ 
	[Measures].[Total ITD PnL], 
	[Measures].[Total Commitment], 
	[Measures].[Percent Hedge]
}  on columns,
non empty 
{ 
	nonempty
	(
		crossjoin
		(
			{ 
				( 
					[Sub Group Hedges].[Sub Group].&[SubGroup1], 
					[Sub Group Hedges].[Position Hedge].&[Hedge] 
				) 
			} , 
			{ 
				order
				(
					{
						{
							[Security].[SecurityDesc].[SecurityDesc].members
						}
					}, 
					[Measures].[XtraPivotGrid -728462353 Sort], asc
				)
			}
		), 
		{
			[Measures].[Total ITD PnL], 
			[Measures].[Total Commitment], 
			[Measures].[Percent Hedge]
		}
	)
} 
dimension properties MEMBER_UNIQUE_NAME,MEMBER_TYPE,MEMBER_VALUE  on rows
from 
(
	select
	{
		{
			[Sub Group Hedges].[Sub Group].[Sub Group].members
		} - 
		{ 
			[Sub Group Hedges].[Sub Group].&
		}
	} on columns
	from [Model]
)



Viewing all articles
Browse latest Browse all 14337

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>