> -----Original Message-----
> From: Hannu Krosing [mailto:hannu@tm.ee]
> Sent: Wednesday, June 19, 2002 1:25 PM
> To: Dann Corbit
> Cc: ryan@paymentalliance.net; pgsql-hackers@postgresql.org
> Subject: RE: [HACKERS] count and group by question
>
>
> On Thu, 2002-06-20 at 03:15, Dann Corbit wrote:
> > > > Which reminds me, it would be nice to have the cube/rollup
> > > sort of OLAP
> > > > stuff from SQL99 ISO/IEC 9075-2:1999 (E) in PostgreSQL:
> > >
> > > It seems like simple ROLLUP and () (i.e. grandTotal) would be
> > > doable by
> > > current executor and plans, i.e. sort and then aggregate,
> > > just add more
> > > aggregate fields and have different start/finalize conditions
> > >
> > > CUBE and GROUPING SETS will probably need another kind of
> execution
> > > plan, perhaps some kind of hashed tuple list.
> >
> > Rollup can be simulated by a bunch of union all... Here is
> an example:
> > http://www.quest-pipelines.com/newsletter-v2/rollup.htm
>
> I guess that all groupings are, just it would be much more efficient
> (not to mention simpler for user ;) if they could be done in one pass.
>
> But rewriting them to UNIONS seems a good stopgap solution.
Yes. It was to show the concept (not to you). Obviously, it would be
much better to do it correctly internally (which is why I asked for the
feature).
> IIRC the OLAP supplement had also an option to tell wheather
> NULLS sort
> at the beginning or end.