Re: Planning aggregates which require sorted or distinct - Mailing list pgsql-hackers

From Gavin Sherry
Subject Re: Planning aggregates which require sorted or distinct
Date
Msg-id Pine.LNX.4.58.0701200849210.9466@linuxworld.com.au
Whole thread Raw
In response to Re: Planning aggregates which require sorted or distinct input  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Planning aggregates which require sorted or distinct  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, 19 Jan 2007, Tom Lane wrote:

> Gavin Sherry <swm@alcove.com.au> writes:
> > What we want to do is have a kind of 'sub plan' for each aggregate. In
> > effect, the plan might start looking like a directed graph.  Here is part
> > of the plan as a directed graph.
>
> >                        GroupAggregate
> >               /-----------------^---------------...
> >               |                 |
> >               |                 |
> >               ^                 |
> >               |               Unique
> >               |                 ^
> >               |                 |
> >             Sort               Sort
> >           (saledate)    (saledate,prodid)
> >               ^                 ^
> >               |                 |
> >               -------------- Fan Out ------------...
> >                                 ^
> >                                 |
> >                                Scan
>
> > This idea was presented by Brian Hagenbuch at Greenplum. He calls it a
> > 'Fan Out' plan. It is trivial to rejoin the data because all data input to
> > the aggregates is sorted by the same primary key.
>
> Er, what primary key would that be exactly?  And even if you had a key,
> I wouldn't call joining on it trivial; I'd call it expensive ...

I should have used slightly different language. What I meant to say was,
both sets are primarily sorted by saledate so they can be merged back
together. This is why I said it was trivial.

Thanks,

Gavin


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] Autovacuum Improvements
Next
From: Gavin Sherry
Date:
Subject: Re: Planning aggregates which require sorted or distinct