From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Atri Sharma <atri(dot)jiit(at)gmail(dot)com> |
Cc: | KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila(at)enterprisedb(dot)com> |
Subject: | Re: Combining Aggregates |
Date: | 2014-12-17 10:18:51 |
Message-ID: | CA+U5nM+nHGiuzFcZB9C3jxRcxkqVC9jRqo6oy+MBG5ebbFg5tQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 17 December 2014 at 10:02, Atri Sharma <atri(dot)jiit(at)gmail(dot)com> wrote:
>
>
> On Wed, Dec 17, 2014 at 3:23 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>>
>> KaiGai, David Rowley and myself have all made mention of various ways
>> we could optimize aggregates.
>>
>> Following WIP patch adds an extra function called a "combining
>> function", that is intended to allow the user to specify a
>> semantically correct way of breaking down an aggregate into multiple
>> steps.
>>
>> Gents, is this what you were thinking? If not...
>>
>>
>
> A quick look at the patch makes me assume that the patch does not handle the
> problem of combining transvals or move at all in that direction (which is
> fine, just reconfirming).
There are no applications of the new function at present. Each would
be similar, but unsure as to whether they would be identical.
> So, essentially, we are adding a "grand total" on top of individual sum() or
> count() operations,right?
The idea is to be able to do aggregation in multiple parts. For
example, allowing parallel query to have a plan like this
Aggregate
->Gather (subPlan is repeated N times on each parallel worker)
->Aggregate
-->ParallelSeqScan (scans a distinct portion of a table)
or to allow a serial plan where an aggregate was pushed down below a
join, like this
CURRENT PLAN
Aggregate
-> Join
-> Scan BaseTable1
-> Scan BaseTable2
PRE-AGGREGATED PLAN
Aggregate
-> Join
-> PreAggregate (doesn't call finalfn)
-> Scan BaseTable1
-> Scan BaseTable2
and also allow the above plan to be replaced by a Matview plan like this
Aggregate
-> Join
-> Scan BaseTable1.matviewA
-> Scan BaseTable2
where we would assume that the contents of matviewA are
pre-aggregations that could be further combined.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2014-12-17 10:20:29 | Re: Combining Aggregates |
Previous Message | Petr Jelinek | 2014-12-17 10:17:04 | Re: Combining Aggregates |