dbTalk Databases Forums  

Count of selected items only - very slow query

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


Discuss Count of selected items only - very slow query in the microsoft.public.sqlserver.olap forum.



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

Default Count of selected items only - very slow query - 11-09-2006 , 09:19 AM






I wondered if anyone might be able to help me to speed up a calculated
member by improving on the MDX.
I want to count the leaf level members of our Policy.NewCOB dimension
only where another calculated measure, Test1, exists (this member is
null for some policies).

I have created the count member, Test2, thus:

Count(Filter(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
(NOT IsEmpty([Measures].[Test1]))))

but because there are 170 000 or so policies, this is very slow.

Any ideas gratefully received!


Reply With Quote
  #2  
Old   
Ohjoo Kwon
 
Posts: n/a

Default Re: Count of selected items only - very slow query - 11-09-2006 , 10:44 AM






How about next expression?

Count(
CrossJoin(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
{[Measures].[Test1]}), ExcludeEmpty
)

If you use AS 2005, you can consider use NonEmpty or exists functions. For
example,

Count(NonEmpty(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
[Measures].[Test1]))

Because NonEmpty function is optimized function to remove empty tuple.

Ohjoo



"rachel" <rachel.jones (AT) talbotuw (DOT) com> wrote

Quote:
I wondered if anyone might be able to help me to speed up a calculated
member by improving on the MDX.
I want to count the leaf level members of our Policy.NewCOB dimension
only where another calculated measure, Test1, exists (this member is
null for some policies).

I have created the count member, Test2, thus:

Count(Filter(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
(NOT IsEmpty([Measures].[Test1]))))

but because there are 170 000 or so policies, this is very slow.

Any ideas gratefully received!




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

Default Re: Count of selected items only - very slow query - 11-09-2006 , 12:06 PM



Thank you very much Ohjoo, that does also work but unfortunately is as
slow as the other method. We are going to upgrade to AS2005 so maybe
that will improve the speed, but non empty doesn't really help as all
our measures are populated (ie there are no nulls in them, they all
evaluate to zero if empty).
Rachel
Ohjoo Kwon wrote:

Quote:
How about next expression?

Count(
CrossJoin(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
{[Measures].[Test1]}), ExcludeEmpty
)

If you use AS 2005, you can consider use NonEmpty or exists functions. For
example,

Count(NonEmpty(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
[Measures].[Test1]))

Because NonEmpty function is optimized function to remove empty tuple.

Ohjoo



"rachel" <rachel.jones (AT) talbotuw (DOT) com> wrote in message
news:1163085556.743430.277210 (AT) h48g2000cwc (DOT) googlegroups.com...
I wondered if anyone might be able to help me to speed up a calculated
member by improving on the MDX.
I want to count the leaf level members of our Policy.NewCOB dimension
only where another calculated measure, Test1, exists (this member is
null for some policies).

I have created the count member, Test2, thus:

Count(Filter(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
(NOT IsEmpty([Measures].[Test1]))))

but because there are 170 000 or so policies, this is very slow.

Any ideas gratefully received!



Reply With Quote
  #4  
Old   
Jeje
 
Posts: n/a

Default Re: Count of selected items only - very slow query - 11-09-2006 , 08:15 PM



you have to optimize the cube correctly to improve the performance.
also try to change the connectionstring to add Cache Policy=7

in SSAS 2005 use a real distinct count measure to insure the performance.
If you want to continue to use a calculated measure double test the nonempty
& exists functions... their behavior are different and I recommand to use
the 2 functions at the same time if your Policy dimension will provide
attributes accessible outside a use hierarchy
exists isolate members regarding other attributes, nonempty isolate members
regarding existing data in the cube; without using the 2 at the same time
the dynamic DCount doesn't work correctly.


"rachel" <rachel.jones (AT) talbotuw (DOT) com> wrote

Quote:
Thank you very much Ohjoo, that does also work but unfortunately is as
slow as the other method. We are going to upgrade to AS2005 so maybe
that will improve the speed, but non empty doesn't really help as all
our measures are populated (ie there are no nulls in them, they all
evaluate to zero if empty).
Rachel
Ohjoo Kwon wrote:

How about next expression?

Count(
CrossJoin(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
{[Measures].[Test1]}), ExcludeEmpty
)

If you use AS 2005, you can consider use NonEmpty or exists functions.
For
example,

Count(NonEmpty(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
[Measures].[Test1]))

Because NonEmpty function is optimized function to remove empty tuple.

Ohjoo



"rachel" <rachel.jones (AT) talbotuw (DOT) com> wrote in message
news:1163085556.743430.277210 (AT) h48g2000cwc (DOT) googlegroups.com...
I wondered if anyone might be able to help me to speed up a calculated
member by improving on the MDX.
I want to count the leaf level members of our Policy.NewCOB dimension
only where another calculated measure, Test1, exists (this member is
null for some policies).

I have created the count member, Test2, thus:

Count(Filter(Descendants([Policy].[NewCOB].CurrentMember, [PolId]),
(NOT IsEmpty([Measures].[Test1]))))

but because there are 170 000 or so policies, this is very slow.

Any ideas gratefully received!




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.