Re: Fix BUG #17335: Duplicate result rows in Gather node

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix BUG #17335: Duplicate result rows in Gather node
Date: 2022-01-25 21:30:59
Message-ID: CAApHDvqC3-s1OWQfGj11ahRD3YqRNKGr+U8KS033YNXZM50V2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 26 Jan 2022 at 05:32, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Therefore, what I think could be useful is some very-late-stage
> assertion check (probably in createplan.c) verifying that the
> child of a Gather is parallel-aware. Or maybe the condition
> needs to be more general than that, but anyway the idea is for
> the back end of the planner to verify that we didn't build a
> silly plan.

Yeah, it would be nice to have something like this. I think to do it,
we might need to invent some sort of path traversal function that can
take a custom callback function. The problem is that the parallel
aware path does not need to be directly below the gather/gathermerge.

For example (from select_distinct.out)

Unique
-> Sort
Sort Key: four
-> Gather
Workers Planned: 2
-> HashAggregate
Group Key: four
-> Parallel Seq Scan on tenk1

For this case, the custom callback would check that there's at least 1
parallel_aware subpath below the Gather/GatherMerge.

There's probably some other rules that we could Assert are true. I
think any parallel_aware paths (unless they're scans) must contain
only parallel_aware subpaths. For example, parallel hash join must
have a parallel aware inner and outer.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-01-25 21:35:52 Re: Replace uses of deprecated Python module distutils.sysconfig
Previous Message Mark Dilger 2022-01-25 21:29:55 Re: CREATEROLE and role ownership hierarchies