evaluating target list in parallel workers

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: evaluating target list in parallel workers
Date: 2016-02-07 20:29:16
Message-ID: CA+TgmoaqWH8W35c7pssuufxOO=AxNEQEN4da_BkeQaA3SE33QQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 22, 2015 at 2:49 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Thu, Oct 22, 2015 at 1:38 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Um ... why would you not want the projections to happen in the child
>> nodes, where they could be parallelized? Or am I missing something?
>
> You probably would, but sometimes that might not be possible; for
> example, the tlist might contain a parallel-restricted function (which
> therefore has to run in the leader).

And here's a (rather small) patch to push target-list evaluation down
to the worker whenever possible. With this, if you do something like
...

SELECT aid + bid FROM pgbench_accounts WHERE aid % 10000 = 0;

...then aid + bid can be calculated in the workers rather than in the
leader. Unfortunately, if you do this...

SELECT sum(aid + bid) FROM pgbench_accounts WHERE aid % 10000 = 0;

...then it doesn't help, because make_subplanTargetList() thinks it
may as well just pull aid and bid out of the join nest and then do the
sum during the aggregation stage. Presumably if we get the parallel
aggregation stuff working then this will get fixed, because there will
be a Partial Aggregate step before the Gather. But whether that gets
into 9.6 or not, this seems like a useful step forward.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
parallel-tlist-pushdown.patch application/x-patch 954 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2016-02-07 21:47:22 Re: remove wal_level archive
Previous Message Tom Lane 2016-02-07 19:17:24 Re: First-draft release notes for next week's back-branch releases