Re: Pushdown target list below gather node (WAS Re: WIP: Upper planner pathification)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pushdown target list below gather node (WAS Re: WIP: Upper planner pathification)
Date: 2016-03-18 13:52:26
Message-ID: CA+Tgmoa38_jDWhJvf3+VkNmPeWNRTZHLRs157xnvqVNsvQLsEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 16, 2016 at 2:25 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, Mar 16, 2016 at 2:02 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Looks pretty close. One point is that if we do end up using a Result
>>> node, then the parent GatherPath does not get charged for the Result
>>> node's cpu_per_tuple overhead. I'm not sure that that's worth changing
>>> though. It's probably better to bet that the subpath is projectable and
>>> so no cost will ensue, than to bet the other way.
>
>> I'm almost sure this way is the better bet.
>
> Actually, we do know what will happen ... so maybe
>
> /*
> * We always use create_projection_path here, even if the subpath is
> * projection-capable, so as to avoid modifying the subpath in place.
> * It seems unlikely at present that there could be any other
> * references to the subpath anyway, but better safe than sorry.
> */
> + if (!is_projection_capable_path(gpath->subpath))
> + gpath->path.total_cost += cpu_tuple_cost * gpath->subpath->rows;
> gpath->subpath = (Path *)
> create_projection_path(root,
> gpath->subpath->parent,
> gpath->subpath,
> target);
>
> The comment could use adjustment if you adopt that, to reference the fact
> that we know create_projection_plan will get rid of the Result if not
> needed.

OK, I've committed something along those lines. Thanks for the
advice, and feel free to whack it around if you have an idea for
improving it further - though IMHO this is good enough for 9.6.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-03-18 13:54:05 Re: btree_gin and btree_gist for enums
Previous Message Tom Lane 2016-03-18 13:42:47 Re: GinPageIs* don't actually return a boolean