Re: count and group by question - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: count and group by question
Date
Msg-id 1024518286.2191.23.camel@rh72.home.ee
Whole thread Raw
In response to Re: count and group by question  ("Dann Corbit" <DCorbit@connx.com>)
List pgsql-hackers
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.

IIRC the OLAP supplement had also an option to tell wheather NULLS sort
at the beginning or end.

-------------------
Hannu




pgsql-hackers by date:

Previous
From: "Dann Corbit"
Date:
Subject: Re: count and group by question
Next
From: "Dann Corbit"
Date:
Subject: Re: count and group by question