pgsql: Refactor and cleanup runtime partition prune code a little - Mailing list pgsql-committers

From Alvaro Herrera
Subject pgsql: Refactor and cleanup runtime partition prune code a little
Date
Msg-id E1nbfnN-000Pe5-1s@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Refactor and cleanup runtime partition prune code a little

* Move the execution pruning initialization steps that are common
between both ExecInitAppend() and ExecInitMergeAppend() into a new
function ExecInitPartitionPruning() defined in execPartition.c.
Those steps include creation of a PartitionPruneState to be used for
all instances of pruning and determining the minimal set of child
subplans that need to be initialized by performing initial pruning if
needed, and finally adjusting the subplan_map arrays in the
PartitionPruneState to reflect the new set of subplans remaining
after initial pruning if it was indeed performed.
ExecCreatePartitionPruneState() is no longer exported out of
execPartition.c and has been renamed to CreatePartitionPruneState()
as a local sub-routine of ExecInitPartitionPruning().

* Likewise, ExecFindInitialMatchingSubPlans() that was in charge of
performing initial pruning no longer needs to be exported.  In fact,
since it would now have the same body as the more generally named
ExecFindMatchingSubPlans(), except differing in the value of
initial_prune passed to the common subroutine
find_matching_subplans_recurse(), it seems better to remove it and add
an initial_prune argument to ExecFindMatchingSubPlans().

* Add an ExprContext field to PartitionPruneContext to remove the
implicit assumption in the runtime pruning code that the ExprContext to
use to compute pruning expressions that need one can always rely on the
PlanState providing it.  A future patch will allow runtime pruning (at
least the initial pruning steps) to be performed without the
corresponding PlanState yet having been created, so this will help.

Author: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CA+HiwqEYCpEqh2LMDOp9mT+4-QoVe8HgFMKBjntEMCTZLpcCCA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/297daa9d43539fbf5fbb3c3a2cca190d0e3da471

Modified Files
--------------
src/backend/executor/execPartition.c   | 459 +++++++++++++++++----------------
src/backend/executor/nodeAppend.c      |  41 +--
src/backend/executor/nodeMergeAppend.c |  34 +--
src/backend/partitioning/partprune.c   |  24 +-
src/include/executor/execPartition.h   |  31 ++-
src/include/partitioning/partprune.h   |   2 +
6 files changed, 298 insertions(+), 293 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Update some tests in 013_crash_restart.pl.
Next
From: Michael Paquier
Date:
Subject: pgsql: Extend TAP tests of pg_dump to test for compression with gzip