dbTalk Databases Forums  

Simple Optimization advice needed

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Simple Optimization advice needed in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
martinbx
 
Posts: n/a

Default Simple Optimization advice needed - 08-30-2005 , 08:21 AM






Hi!
I would be thnkful for advice on how to optimize following code:
iif
(
Descendants(A,10, LEAVES).Count < 1,
0,
iif
(
Descendants(A,10, LEAVES).Item(0).Property("X")=CStr("123"),
0,
iif
(
Descendants(A,10,
LEAVES).Item(0).Property("Y")=CStr("768"),
1,
0
)
)
)

I do Descendants(A,10, LEAVES) three times. Is it possible to do it only
once ?

Reply With Quote
  #2  
Old   
Joel Leong
 
Posts: n/a

Default Re: Simple Optimization advice needed - 08-30-2005 , 11:43 AM






can you use AND operator

iif(Descendants(...).Count <1 AND ..... AND ...., 0, 1) ??

"martinbx" <martinbx (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi!
I would be thnkful for advice on how to optimize following code:
iif
(
Descendants(A,10, LEAVES).Count < 1,
0,
iif
(
Descendants(A,10, LEAVES).Item(0).Property("X")=CStr("123"),
0,
iif
(
Descendants(A,10,
LEAVES).Item(0).Property("Y")=CStr("768"),
1,
0
)
)
)

I do Descendants(A,10, LEAVES) three times. Is it possible to do it only
once ?



Reply With Quote
  #3  
Old   
martinbx
 
Posts: n/a

Default Re: Simple Optimization advice needed - 08-30-2005 , 12:54 PM



It will not help, because I still have to call Descendants(A,10, LEAVES) 3
times in a row to get EXACTLY the same information

"Joel Leong" wrote:

Quote:
can you use AND operator

iif(Descendants(...).Count <1 AND ..... AND ...., 0, 1) ??

"martinbx" <martinbx (AT) discussions (DOT) microsoft.com> wrote in message
news:38C40AFB-B07C-4F15-A773-946210987B2D (AT) microsoft (DOT) com...
Hi!
I would be thnkful for advice on how to optimize following code:
iif
(
Descendants(A,10, LEAVES).Count < 1,
0,
iif
(
Descendants(A,10, LEAVES).Item(0).Property("X")=CStr("123"),
0,
iif
(
Descendants(A,10,
LEAVES).Item(0).Property("Y")=CStr("768"),
1,
0
)
)
)

I do Descendants(A,10, LEAVES) three times. Is it possible to do it only
once ?




Reply With Quote
  #4  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Simple Optimization advice needed - 08-31-2005 , 12:07 AM



You could try a Set Alias, as in this Foodmart query:

Quote:
With Member [Measures].[DescendTest] as
'iif({Descendants([Employees].CurrentMember, 4, LEAVES) as SetD}.Count <
1,
0,
iif(SetD.Item(0).Properties("Marital Status") = "S",
0,
iif(SetD.Item(0).Properties("Gender") = "F",
1, 0)))'
select {[Measures].[StoreCount], [Measures].[DescendTest]} on columns,
{[Employees].[All Employees].[Sheri Nowmer].[Donna Arnold]} on rows
from HR
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #5  
Old   
martinbx
 
Posts: n/a

Default Re: Simple Optimization advice needed - 08-31-2005 , 01:07 PM



Thanks.

"Deepak Puri" wrote:

Quote:
You could try a Set Alias, as in this Foodmart query:


With Member [Measures].[DescendTest] as
'iif({Descendants([Employees].CurrentMember, 4, LEAVES) as SetD}.Count
1,
0,
iif(SetD.Item(0).Properties("Marital Status") = "S",
0,
iif(SetD.Item(0).Properties("Gender") = "F",
1, 0)))'
select {[Measures].[StoreCount], [Measures].[DescendTest]} on columns,
{[Employees].[All Employees].[Sheri Nowmer].[Donna Arnold]} on rows
from HR



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.