Re: Gather Merge

From: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Gather Merge
Date: 2017-03-09 16:25:33
Message-ID: CAGPqQf11MVo2Fj06wk_QF8+BgiDGTfQ2-MeyeUE7PJoHZhgg+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 9, 2017 at 9:42 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Thu, Mar 9, 2017 at 8:21 AM, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
> wrote:
> > Thanks Robert for committing this.
> >
> > My colleague Neha Sharma found one regression with the patch. I was about
> > to send this mail and noticed that you committed the patch.
>
> Oops. Bad timing.
>
> > postgres=# explain select aid from pgbench_accounts where aid % 25= 0
> group
> > by aid;
> > ERROR: ORDER/GROUP BY expression not found in targetlist
>
> I think your fix for this looks right, although I would write it this way:
>
> - gm_plan->plan.targetlist = subplan->targetlist;
> + gm_plan->plan.targetlist = build_path_tlist(root, &best_path->path);
>
> The second part of your fix looks wrong. I think you want this:
>
> create_gather_merge_path(root,
> grouped_rel,
> subpath,
> - NULL,
> + partial_grouping_target,
> root->group_pathkeys,
> NULL,
> &total_groups);
>
> That will match the create_gather_path case.
>
>
Right, I did that change and perform the test with the fix and I don't
see any regression now.

> This test case is still failing for me even with those fixes:
>
> rhaas=# select aid+1 from pgbench_accounts group by aid+1;
> ERROR: could not find pathkey item to sort
>
>
I don't see this failure with the patch. Even I forced the gather merge
in the above query and that just working fine.

Attaching patch, with the discussed changes.

Thanks,
Rushabh Lathia

Attachment Content-Type Size
fix_target_gm_v2.patch application/x-download 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2017-03-09 16:31:42 Re: [bug fix] dblink leaks unnamed connections
Previous Message Pavel Stehule 2017-03-09 16:19:14 Re: New CORRESPONDING clause design