Re: count and group by question

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Dann Corbit <DCorbit(at)connx(dot)com>
Cc: ryan(at)paymentalliance(dot)net, pgsql-hackers(at)postgresql(dot)org
Subject: Re: count and group by question
Date: 2002-06-19 20:24:46
Message-ID: 1024518286.2191.23.camel@rh72.home.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dann Corbit 2002-06-19 21:02:17 Re: count and group by question
Previous Message Hannu Krosing 2002-06-19 20:07:11 Re: count and group by question