pgsql: pg_plan_advice: Fix multiple problems with NO_GATHER advice.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_plan_advice: Fix multiple problems with NO_GATHER advice.
Date: 2026-10-28 19:33:03
Message-ID: E1xM9OR-000000019a2-19MM@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_plan_advice: Fix multiple problems with NO_GATHER advice.

First, the documentation describes NO_GATHER in a way that suggests
that it should both suppress partial path generation and also prohibit
the placement of Gather and Gather Merge within a join problem, but in
fact it only did the latter. Change it to do the former as well. Like
commit f71a9969d58e3e70239fc51bbeae668db973b265, this is fallout from
my failure to realize everything that needed to be changed when I
abandoned the idea of clearing consider_parallel as a way to suppress
parallel paths.

Second, emit NO_GATHER advice for the non-partial children of a
Parallel Append, because we want exactly the behaviors described
above for that case. In order to reproduce the Parallel Append, we'll
need an entirely non-parallel path for that child.

Third, update the documentation to be more precise about what happens
when NO_GATHER is applied to a child table. I believe I intended this
to work in the way described in the first paragraph above, but because
of the omission noted there, it had no effect at all. Moreover, the
documentation described the two different effects of NO_GATHER as if
subqueries were the only relevant case, but partitioning or table
inheritance gives rise to similar effects, so clarify accordingly.

Discussion: http://postgr.es/m/CA+Tgmob3X+_CSjAa_BtU9bXrX_ge_HyvO=7gSCLtBpncGwn-kQ@mail.gmail.com
Tested-by: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4fdfdaf638acc1a080768338e31862cf1716d5a6

Modified Files
--------------
contrib/pg_plan_advice/expected/gather.out | 129 +++++++++++++++++++++++++++++
contrib/pg_plan_advice/pgpa_planner.c | 101 ++++++++++++++++++++++
contrib/pg_plan_advice/pgpa_walker.c | 20 ++++-
contrib/pg_plan_advice/sql/gather.sql | 37 +++++++++
doc/src/sgml/pgplanadvice.sgml | 13 ++-
src/tools/pgindent/typedefs.list | 1 +
6 files changed, 297 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Previous Message Robert Haas 2026-10-28 19:32:44 Re: pgsql: Set HEAP_XMAX_INVALID for tuples updated by aborted subtransacti