pgsql: Store information about Append node consolidation in the final p - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Store information about Append node consolidation in the final p
Date
Msg-id E1vpwfS-0003kq-1L@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Store information about Append node consolidation in the final plan.

An extension (or core code) might want to reconstruct the planner's
decisions about whether and where to perform partitionwise joins from
the final plan. To do so, it must be possible to find all of the RTIs
of partitioned tables appearing in the plan. But when an AppendPath
or MergeAppendPath pulls up child paths from a subordinate AppendPath
or MergeAppendPath, the RTIs of the subordinate path do not appear
in the final plan, making this kind of reconstruction impossible.

To avoid this, propagate the RTI sets that would have been present
in the 'apprelids' field of the subordinate Append or MergeAppend
nodes that would have been created into the surviving Append or
MergeAppend node, using a new 'child_append_relid_sets' field for
that purpose. The value of this field is a list of Bitmapsets,
because each relation whose append-list was pulled up had its own
set of RTIs: just one, if it was a partitionwise scan, or more than
one, if it was a partitionwise join. Since our goal is to see where
partitionwise joins were done, it is essential to avoid losing the
information about how the RTIs were grouped in the pulled-up
relations.

This commit also updates pg_overexplain so that EXPLAIN (RANGE_TABLE)
will display the saved RTI sets.

Co-authored-by: Robert Haas <rhaas@postgresql.org>
Co-authored-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7358abcc6076f4b2530d10126ab379f8aea612a5

Modified Files
--------------
contrib/pg_overexplain/expected/pg_overexplain.out |  10 +-
contrib/pg_overexplain/pg_overexplain.c            |  56 ++++++
src/backend/optimizer/path/allpaths.c              | 199 +++++++++++++--------
src/backend/optimizer/path/joinrels.c              |   3 +-
src/backend/optimizer/plan/createplan.c            |   2 +
src/backend/optimizer/plan/planner.c               |   7 +-
src/backend/optimizer/prep/prepunion.c             |  43 +++--
src/backend/optimizer/util/pathnode.c              |  26 +--
src/include/nodes/pathnodes.h                      |  10 ++
src/include/nodes/plannodes.h                      |  11 ++
src/include/optimizer/pathnode.h                   |  18 +-
src/tools/pgindent/typedefs.list                   |   1 +
12 files changed, 274 insertions(+), 112 deletions(-)


pgsql-committers by date:

Previous
From: noreply@postgresql.org
Date:
Subject: pgsql: Tag refs/tags/REL_16_12 was created
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Remove useless store to local variable