Re: OLAP CUBE/ROLLUP Operators and GROUP BY grouping sets - Mailing list pgsql-hackers

From Robert Bedell
Subject Re: OLAP CUBE/ROLLUP Operators and GROUP BY grouping sets
Date
Msg-id 200312171926323.SM00984@xavier
Whole thread Raw
In response to Re: OLAP CUBE/ROLLUP Operators and GROUP BY grouping sets  ("Robert Bedell" <robert@friendlygenius.com>)
List pgsql-hackers
> > For pure ROLLUP one could shortcut the split-into-groups and
> > put-together-again process, as ROLLUP is already doable from single
> > sorted scan.
> 
> Actually as long as the grouping sets are all left-continuous of the
> longest
> grouping set it's doable from a single sorted scan.  If done with the
> right
> implementation separating resetable aggregators and out of order
> aggregators
> you could get this optimization for free.  This avoids having to look for
> ROLLUP specifically.

Ok, putting it that way was kind of dumb - and you already said that mostly.
What I mean to say is you don't have to check for ROLLUP specifically to get
that optimization..  This also allows you to do "GROUP BY a, b, ROLLUP(c,d)"
(resulting in grouping sets {{a,b,c,d},{a,b,c},{a,b}}) in an optimized
fashion without having to check for PURE rollup.

Cheers,

Robert



pgsql-hackers by date:

Previous
From: "Robert Bedell"
Date:
Subject: Re: OLAP CUBE/ROLLUP Operators and GROUP BY grouping sets
Next
From: "Andrew Dunstan"
Date:
Subject: Re: TODO list