Re: fixing consider_parallel for upper planner rels

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Amit Kapila <amit(dot)kapila(at)enterprisedb(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fixing consider_parallel for upper planner rels
Date: 2016-07-01 14:52:28
Message-ID: 19503.1467384748@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Jun 30, 2016 at 5:54 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> And the point of that is what, exactly? If the only change is that
>> "some restrictions get enforced", I am not clear on why we need such
>> a test mode in cases where the planner is afraid to put a top Gather on
>> the plan. In particular, given the coding as you now have it, it seems
>> like the only case where there's any difference is where we set
>> glob->parallelModeOK but nonetheless end up with a not-parallel-safe
>> topmost path (that doesn't have a Gather within it). It's not clear
>> to me why having the executor switch into parallel mode makes sense at
>> all with such a plan.

> Suppose you create a PL/pgsql function that does an UPDATE and mark it
> PARALLEL RESTRICTED. You wonder whether you've marked it correctly.
> You can set force_parallel_mode=on and SELECT myfunc(). The
> subsequent ERROR tells you that you've mismarked it.

Right, but that statement is still true with the logic I'm imagining.
I would also argue that the existing text in config.sgml explaining
what this parameter does corresponds much more nearly to what I'm
suggesting than to what you say the semantics are.

>> What I'm not happy about is that as you've got things constituted,
>> the GetForeignUpperPaths hook is broken so far as injecting parallel paths
>> is concerned, because the consider_parallel flags for the upperrels
>> aren't set yet when it gets called. If we keep consider_parallel with
>> its present usage, we're going to have to refactor things to fix that.

> I see. It seems to me, and I may be failing to understand something,
> that the placement of create_upper_paths_hook is substantially better
> than the placement of GetForeignUpperPaths. If the latter were moved
> to where the former now is, then consider_parallel would be set
> sufficiently early and everything would be fine.

Yeah, I came to more or less the same conclusion last night. Will see
to it after you commit this.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jean-Pierre Pelletier 2016-07-01 15:07:32 The link to download PostgreSQL 9.6 Beta 2 for Windows X64 is broken (The link downloads Beta 1)
Previous Message Masahiko Sawada 2016-07-01 14:22:42 Re: Reviewing freeze map code