Re: Partition-wise aggregation/grouping

From: Antonin Houska <ah(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Partition-wise aggregation/grouping
Date: 2017-04-27 11:23:46
Message-ID: 27699.1493292226@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Wed, Apr 26, 2017 at 6:28 AM, Antonin Houska <ah(at)cybertec(dot)at> wrote:
> > Attached is a diff that contains both patches merged. This is just to prove my
> > assumption, details to be elaborated later. The scripts attached produce the
> > following plan in my environment:
> >
> > QUERY PLAN
> > ------------------------------------------------
> > Parallel Finalize HashAggregate
> > Group Key: b_1.j
> > -> Append
> > -> Parallel Partial HashAggregate
> > Group Key: b_1.j
> > -> Hash Join
> > Hash Cond: (b_1.j = c_1.k)
> > -> Seq Scan on b_1
> > -> Hash
> > -> Seq Scan on c_1
> > -> Parallel Partial HashAggregate
> > Group Key: b_2.j
> > -> Hash Join
> > Hash Cond: (b_2.j = c_2.k)
> > -> Seq Scan on b_2
> > -> Hash
> > -> Seq Scan on c_2
>
> Well, I'm confused. I see that there's a relationship between what
> Antonin is trying to do and what Jeevan is trying to do, but I can't
> figure out whether one is a subset of the other, whether they're both
> orthogonal, or something else. This plan looks similar to what I
> would expect Jeevan's patch to produce,

The point is that the patch Jeevan wanted to work on is actually a subset of
[1] combined with [2].

> except i have no idea what "Parallel" would mean in a plan that contains no
> Gather node.

parallel_aware field was set mistakenly on the AggPath. Fixed patch is
attached below, producing this plan:

QUERY PLAN
------------------------------------------------
Finalize HashAggregate
Group Key: b_1.j
-> Append
-> Partial HashAggregate
Group Key: b_1.j
-> Hash Join
Hash Cond: (b_1.j = c_1.k)
-> Seq Scan on b_1
-> Hash
-> Seq Scan on c_1
-> Partial HashAggregate
Group Key: b_2.j
-> Hash Join
Hash Cond: (b_2.j = c_2.k)
-> Seq Scan on b_2
-> Hash
-> Seq Scan on c_2

[1] https://www.postgresql.org/message-id/9666.1491295317%40localhost

[2] https://commitfest.postgresql.org/14/994/

--
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de, http://www.cybertec.at

Attachment Content-Type Size
agg_pushdown_partition_wise_v2.diff text/x-diff 386.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2017-04-27 12:28:40 pgsql: Additional tests for subtransactions in recovery
Previous Message Petr Jelinek 2017-04-27 10:47:26 Re: Interval for launching the table sync worker