optimize TopCount when CrossJoin

optimize TopCount when CrossJoin

Post by Sverke » Tue, 05 Feb 2002 19:58:48



Hi there,

Im trying to speed up a very common query:

TOPCOUNT(
    NONEMPTYCROSSJOIN(
        {[cust].[cust].members},
        {[Prod].[Prod].members}
    ),
    20,
    [Measures].[qty]
)

with the "generate(A,crossjoin(A.currentmember,B))" as
suggested by Spofford in "MDX solutions":

TOPCOUNT(
  generate(
     {[cust].[cust].members},
     topcount(
         NonEmptyCrossjoin(
             {[cust].currentmember},
             {[Prod].[Prod].members }
         ),
         20,
         [Measures].[qty]
     )
  ),
  20,
  [Measures].[qty]
)

This results in a query that takes many times longer than
the original query, even the Test MDX button in proclarity
to check the syntax take about a minute (!).

What am i doing wrong (or is this teqnique only relevant
when crossjoin > 2 dimensions) ?

/Sverker

 
 
 

optimize TopCount when CrossJoin

Post by George Spoffor » Sat, 09 Feb 2002 00:42:59


Actually, I wouldn't (and don't) suggest you could optimize
NonEmptyCrossJoin() in the way that you optimize CrossJoin(). Sometimes
you need to use CrossJoin(), and then I would recommend the
optimization. But NonEmptyCrossJoin() executes differently than
CrossJoin(), leveraging the internal indexes of the cube.

Off the top of my head, I can't think of a general-purpose optimization
for your TopCount (NonEmptyCrossJoin()) expression.


> Hi there,

> Im trying to speed up a very common query:

> TOPCOUNT(
>     NONEMPTYCROSSJOIN(
>         {[cust].[cust].members},
>         {[Prod].[Prod].members}
>     ),
>     20,
>     [Measures].[qty]
> )

> with the "generate(A,crossjoin(A.currentmember,B))" as
> suggested by Spofford in "MDX solutions":

> TOPCOUNT(
>   generate(
>      {[cust].[cust].members},
>      topcount(
>          NonEmptyCrossjoin(
>              {[cust].currentmember},
>              {[Prod].[Prod].members }
>          ),
>          20,
>          [Measures].[qty]
>      )
>   ),
>   20,
>   [Measures].[qty]
> )

> This results in a query that takes many times longer than
> the original query, even the Test MDX button in proclarity
> to check the syntax take about a minute (!).

> What am i doing wrong (or is this teqnique only relevant
> when crossjoin > 2 dimensions) ?

> /Sverker

--
George Spofford
Microsoft MVP
Chief Architect / OLAP Solution Provider
DSS Lab

ISVs & IT organizations: Find out how DSS Lab can speed your
development!

 
 
 

1. Topcount within crossjoin

I'm having a hard time defining MDX for what seems would be a simple query.
For rows, I want to display the top 5 brands for each child of a given
product.  The output should look like:

                                                       Month1   Month2 .....
Month n

Product 1
        Top Brand for Product 1
        Second Brand for Product 1
        Third Brand for Product 1
        Fourth brand from product 1
        Fifth brand from product 1

Product 2
        Top brand for product 2
        etc.

Thanks,

Dan

2. Foreign Key Creation problem

3. crossjoin ( measures , topcount ( dim1 , 3 measures.currentmember) doesn′t work expected

4. Error Handling

5. TopCount Union with Others

6. Best Approach

7. bottomcount and topcount functions: different mechanisms?

8. US-CALIFORNIA-BV SOFTWARE DEVELOPER

9. TopCount

10. Predict query returning count(input rows) * topcount param

11. Filter negative value in a topcount clause?

12. How to do a Topcount from a member

13. Challenge with MDX ->TOPCOUNT