[Mondrian] Infobright Distinct Count

Julian Hyde jhyde at pentaho.com
Thu Feb 10 18:43:54 EST 2011

Eyeballing the code, it only gets called to count the number of members in a
level, and then only

(a) if the level's key is compound
(b) the database has allowsFromQuery() = false

Several examples of (a) in Foodmart (look for non-top levels where
uniqueMEmbers=false), but for (b) you will need old DB2 AS/400, Informix,
MySQL earlier than 4.0 (e.g. 3.23), or Sybase. Not very likely...

Mondrian seems to generate 

Select count(*) from (select distinct ...)

for any database that supports subqueries in the FROM clause. If your goal
is to make it call compound count distinct instead, as an experiment try
temporarily making allowsFromQuery return false.

If that succeeds, then switch the logic around in
SqlMemberSource.makeLevelMemberCountSql to use compound count distinct if
the database supports it, even if it DOES allow subqueries in the FROM


> -----Original Message-----
> From: Tom Barber [mailto:Tom.Barber at ecommera.co.uk] 
> Sent: Thursday, February 10, 2011 3:01 PM
> To: Mondrian developer mailing list; jhyde at pentaho.com
> Subject: RE: [Mondrian] Infobright Distinct Count
> Anyone who can get Mondrian to create a Compound Distinct 
> Count in MDX world from FoodMart, wins a beer.
> Replicating this, is proving mighty tricky.

More information about the Mondrian mailing list