![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Good question, I can repro and I'm surprised that I've never seen this before. The only thing I can think of is that in the first query the query optimiser can do something clever because it realises the calculated member is the same as a real member, something it can't do in the second query. Mosha, if you're reading....??? "Andrew" wrote: Hi All, Please explain the difference in execution duration for the following 2 logically equivalent queries to FoodMart 2000. The first query takes 1 sec to execute at my site, the 2nd query takes 75 sec. with member [Customers].[CM] as '[Customers].[Name].[Alice Cantrell]' SELECT { [Customers].[CM] } ON COLUMNS , NON EMPTY { { [Store].[Store Name].Members } * { [Product].[Product Name].Members } } ON ROWS FROM [Sales] where ([Measures].[Unit Sales]) with member [Customers].[CM] as '[Customers].[Name].[Amy Petranoff].PrevMember' SELECT { [Customers].[CM] } ON COLUMNS , NON EMPTY { { [Store].[Store Name].Members } * { [Product].[Product Name].Members } } ON ROWS FROM [Sales] where ([Measures].[Unit Sales]) |
#3
| |||
| |||
|
| with member [Customers].[CM] as |
#4
| |||
| |||
|
|
Could this have something to do with how well NON EMPTY can be optimized in the 2 cases (since the result set is sparse: only 20 non-empty values out of 37,440)? This version of the second query, using NonEmptyCrossJoin(), seems to be only slightly slower than the 1st query: with member [Customers].[CM] as '[Customers].[Name].[Amy Petranoff].PrevMember' SELECT { [Customers].[CM] } ON COLUMNS , NonEmptyCrossJoin( [Store].[Store Name].Members, [Product].[Product Name].Members, {[Customers].[Name].[Amy Petranoff].PrevMember}, 2) ON ROWS FROM [Sales] where ([Measures].[Unit Sales]) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#5
| |||
| |||
|
|
No - it cannot be it, since both queries use calculated member. The only difference that I noted - was the same as Chris noted - static vs. dynamic binding. But it cannot explain such a huge difference. And even for the slowest iteration - it should not take 75 seconds to iterate 37000 cells. -- ==============================*=================== = Mosha Pasumansky - http://www.mosha.com/msolap Analysis Services blog at http://www.sqljunkies.com/WebL*og/mosha Development Lead in the Analysis Server team All you need is love (John Lennon) Disclaimer : This posting is provided "AS IS" with no warranties, and confers no rights. ==============================*=================== = "Deepak Puri" <deepak_puri (AT) progressive (DOT) com> wrote in message news:uSOB80IQFHA.2972 (AT) TK2MSFTNGP14 (DOT) phx.gbl... Could this have something to do with how well NON EMPTY can be optimized in the 2 cases (since the result set is sparse: only 20 non-empty values out of 37,440)? This version of the second query, using NonEmptyCrossJoin(), seems to be only slightly slower than the 1st query: with member [Customers].[CM] as '[Customers].[Name].[Amy Petranoff].PrevMember' SELECT { [Customers].[CM] } ON COLUMNS , NonEmptyCrossJoin( [Store].[Store Name].Members, [Product].[Product Name].Members, {[Customers].[Name].[Amy Petranoff].PrevMember}, 2) ON ROWS FROM [Sales] where ([Measures].[Unit Sales]) - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#6
| |||
| |||
|
| with member [Gender].[CM] as '[Gender].[M].PrevMember' |
![]() |
| Thread Tools | |
| Display Modes | |
| |