summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-06-10 18:24:34 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-06-10 18:24:34 -0400
commit321f648a312bd188b7a5c33a0548a57f45dfbf42 (patch)
tree6b59b18305571e2bf133b5b2015eb34a93e8f988 /src/include
parent939449de0e571b8c0b07674bb7095e06e93cc059 (diff)
Assorted cosmetic cleanup of run-time-partition-pruning code.
Use "subplan" rather than "subnode" to refer to the child plans of a partitioning Append; this seems a bit more specific and hence clearer. Improve assorted comments. No non-cosmetic changes. David Rowley and Tom Lane Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/execPartition.h48
-rw-r--r--src/include/nodes/plannodes.h16
2 files changed, 34 insertions, 30 deletions
diff --git a/src/include/executor/execPartition.h b/src/include/executor/execPartition.h
index 0216d2132c9..9f0b817c547 100644
--- a/src/include/executor/execPartition.h
+++ b/src/include/executor/execPartition.h
@@ -114,21 +114,21 @@ typedef struct PartitionTupleRouting
/*-----------------------
* PartitionPruningData - Encapsulates all information required to support
- * elimination of partitions in node types which support arbitrary Lists of
- * subplans. Information stored here allows the planner's partition pruning
- * functions to be called and the return value of partition indexes translated
- * into the subpath indexes of node types such as Append, thus allowing us to
- * bypass certain subnodes when we have proofs that indicate that no tuple
- * matching the 'pruning_steps' will be found within.
+ * elimination of partitions in plan types which support arbitrary Lists of
+ * subplans. Information stored here allows the partition pruning functions
+ * to be called and the return value of partition indexes translated into the
+ * subpath indexes of plan types such as Append, thus allowing us to bypass a
+ * subplan when we can prove that no tuple matching the 'pruning_steps' will
+ * be found within.
*
- * subnode_map An array containing the subnode index which
+ * subplan_map An array containing the subplan index which
* matches this partition index, or -1 if the
- * subnode has been pruned already.
- * subpart_map An array containing the offset into the
- * 'partprunedata' array in PartitionPruning, or
+ * subplan has been pruned already.
+ * subpart_map An array containing the index into the
+ * partprunedata array in PartitionPruneState, or
* -1 if there is no such element in that array.
* present_parts A Bitmapset of the partition indexes that we
- * have subnodes mapped for.
+ * have subplans mapped for.
* context Contains the context details required to call
* the partition pruning code.
* pruning_steps List of PartitionPruneSteps used to
@@ -141,7 +141,7 @@ typedef struct PartitionTupleRouting
*/
typedef struct PartitionPruningData
{
- int *subnode_map;
+ int *subplan_map;
int *subpart_map;
Bitmapset *present_parts;
PartitionPruneContext context;
@@ -151,15 +151,15 @@ typedef struct PartitionPruningData
} PartitionPruningData;
/*-----------------------
- * PartitionPruneState - State object required for executor nodes to perform
- * partition pruning elimination of their subnodes. This encapsulates a
+ * PartitionPruneState - State object required for plan nodes to perform
+ * partition pruning elimination of their subplans. This encapsulates a
* flattened hierarchy of PartitionPruningData structs.
- * This struct can be attached to node types which support arbitrary Lists of
- * subnodes containing partitions to allow subnodes to be eliminated due to
- * the clauses being unable to match to any tuple that the subnode could
+ * This struct can be attached to plan types which support arbitrary Lists of
+ * subplans containing partitions to allow subplans to be eliminated due to
+ * the clauses being unable to match to any tuple that the subplan could
* possibly produce.
*
- * partprunedata Array of PartitionPruningData for the node's target
+ * partprunedata Array of PartitionPruningData for the plan's target
* partitioned relation. First element contains the
* details for the target partitioned table.
* num_partprunedata Number of items in 'partprunedata' array.
@@ -167,10 +167,12 @@ typedef struct PartitionPruningData
* startup (at any hierarchy level).
* do_exec_prune true if pruning should be performed during
* executor run (at any hierarchy level).
- * prune_context A memory context which can be used to call the query
- * planner's partition prune functions.
* execparamids Contains paramids of PARAM_EXEC Params found within
- * any of the partprunedata structs.
+ * any of the partprunedata structs. Pruning must be
+ * done again each time the value of one of these
+ * parameters changes.
+ * prune_context A short-lived memory context in which to execute the
+ * partition pruning functions.
*-----------------------
*/
typedef struct PartitionPruneState
@@ -179,8 +181,8 @@ typedef struct PartitionPruneState
int num_partprunedata;
bool do_initial_prune;
bool do_exec_prune;
- MemoryContext prune_context;
Bitmapset *execparamids;
+ MemoryContext prune_context;
} PartitionPruneState;
extern PartitionTupleRouting *ExecSetupPartitionTupleRouting(ModifyTableState *mtstate,
@@ -211,6 +213,6 @@ extern PartitionPruneState *ExecSetupPartitionPruneState(PlanState *planstate,
List *partitionpruneinfo);
extern Bitmapset *ExecFindMatchingSubPlans(PartitionPruneState *prunestate);
extern Bitmapset *ExecFindInitialMatchingSubPlans(PartitionPruneState *prunestate,
- int nsubnodes);
+ int nsubplans);
#endif /* EXECPARTITION_H */
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 00e0416a24b..dacc50edc26 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -1055,19 +1055,21 @@ typedef struct PlanRowMark
* partitions.
*
* Here we store mapping details to allow translation of a partitioned table's
- * index into subnode indexes for node types which support arbitrary numbers
- * of sub nodes, such as Append.
+ * index as returned by the partition pruning code into subplan indexes for
+ * plan types which support arbitrary numbers of subplans, such as Append.
+ * We also store various details to tell the executor when it should be
+ * performing partition pruning.
*/
typedef struct PartitionPruneInfo
{
NodeTag type;
Oid reloid; /* Oid of partition rel */
List *pruning_steps; /* List of PartitionPruneStep, see below */
- Bitmapset *present_parts; /* Indexes of all partitions which subnodes
+ Bitmapset *present_parts; /* Indexes of all partitions which subplans
* are present for. */
- int nparts; /* Length of subnode_map[] and subpart_map[] */
+ int nparts; /* Length of subplan_map[] and subpart_map[] */
int nexprs; /* Length of hasexecparam[] */
- int *subnode_map; /* subnode index by partition id, or -1 */
+ int *subplan_map; /* subplan index by partition id, or -1 */
int *subpart_map; /* subpart index by partition id, or -1 */
bool *hasexecparam; /* true if corresponding pruning_step contains
* any PARAM_EXEC Params. */
@@ -1099,9 +1101,9 @@ typedef struct PartitionPruneStep
* strategy of the operator in the clause matched to the last partition key.
* 'exprs' contains expressions which comprise the lookup key to be passed to
* the partition bound search function. 'cmpfns' contains the OIDs of
- * comparison function used to compare aforementioned expressions with
+ * comparison functions used to compare aforementioned expressions with
* partition bounds. Both 'exprs' and 'cmpfns' contain the same number of
- * items up to partnatts items.
+ * items, up to partnatts items.
*
* Once we find the offset of a partition bound using the lookup key, we
* determine which partitions to include in the result based on the value of