Re: pgsql: Try again to fix the way the scanjoin_target is used with partia

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Robert Haas <rhaas(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Try again to fix the way the scanjoin_target is used with partia
Date: 2016-06-21 19:38:24
Message-ID: 16117.1466537904@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

I wrote:
> I had hoped that this would result in simplifying create_projection_plan
> so that it just makes a Result or not according to what
> create_projection_path decided, but there's one regression test case that
> fails (in the sense of showing a Result in the plan that isn't really
> needed). That happens because create_merge_append_plan adds sort columns
> to the tlist and so a tlist match is possible after that happens when it
> didn't match before. For the moment I kluged create_projection_plan so
> that that keeps working, but I wonder if it'd be better to just accept an
> extra Result in that case.

After further thought about that, I realized the issue is bigger than just
MergeAppend nodes: in general, if createplan.c alters the tlist of a node
by adding resjunk columns, that could break the earlier decision about
whether the tlist expressions are equal, *in either direction*. So we
have to consider that create_projection_path's decision is just tentative
anytime we are dealing with a non-projection-capable subpath. I think
this means that apply_projection_to_path is actually broken right now,
because it supposes that any tlist equality that it sees can't change
later. (It might be that we don't use it in a way that would cause that
to manifest, but I don't have a lot of faith in that, since this code is
all pretty new.) Revised patch attached.

regards, tom lane

Attachment Content-Type Size
refactor-projection-cost-calculations-2.patch text/x-diff 22.2 KB

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-06-21 19:43:46 Re: [COMMITTERS] pgsql: Try again to fix the way the scanjoin_target is used with partia
Previous Message Robert Haas 2016-06-21 19:36:59 Re: [COMMITTERS] pgsql: Try again to fix the way the scanjoin_target is used with partia

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-06-21 19:38:25 Re: Reviewing freeze map code
Previous Message Robert Haas 2016-06-21 19:36:59 Re: [COMMITTERS] pgsql: Try again to fix the way the scanjoin_target is used with partia