aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/nodes.h7
-rw-r--r--src/include/nodes/plannodes.h114
-rw-r--r--src/include/nodes/primnodes.h104
3 files changed, 111 insertions, 114 deletions
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index adb159a6dab..43f1552241c 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -87,6 +87,9 @@ typedef enum NodeTag
/* these aren't subclasses of Plan: */
T_NestLoopParam,
T_PlanRowMark,
+ T_PartitionPruneInfo,
+ T_PartitionPruneStepOp,
+ T_PartitionPruneStepCombine,
T_PlanInvalItem,
/*
@@ -192,10 +195,6 @@ typedef enum NodeTag
T_FromExpr,
T_OnConflictExpr,
T_IntoClause,
- T_PartitionPruneStep,
- T_PartitionPruneStepOp,
- T_PartitionPruneStepCombine,
- T_PartitionPruneInfo,
/*
* TAGS FOR EXPRESSION STATE NODES (execnodes.h)
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index f2dda82e66a..00e0416a24b 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -15,6 +15,7 @@
#define PLANNODES_H
#include "access/sdir.h"
+#include "access/stratnum.h"
#include "lib/stringinfo.h"
#include "nodes/bitmapset.h"
#include "nodes/lockoptions.h"
@@ -248,8 +249,6 @@ typedef struct ModifyTable
typedef struct Append
{
Plan plan;
- /* RT indexes of non-leaf tables in a partition tree */
- List *partitioned_rels;
List *appendplans;
/*
@@ -258,10 +257,11 @@ typedef struct Append
*/
int first_partial_plan;
- /*
- * Mapping details for run-time subplan pruning, one per partitioned_rels
- */
- List *part_prune_infos;
+ /* RT indexes of non-leaf tables in a partition tree */
+ List *partitioned_rels;
+
+ /* Info for run-time subplan pruning, one entry per partitioned_rels */
+ List *part_prune_infos; /* List of PartitionPruneInfo */
} Append;
/* ----------------
@@ -1047,6 +1047,108 @@ typedef struct PlanRowMark
/*
+ * Node types to represent partition pruning information.
+ */
+
+/*
+ * PartitionPruneInfo - Details required to allow the executor to prune
+ * 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.
+ */
+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
+ * are present for. */
+ int nparts; /* Length of subnode_map[] and subpart_map[] */
+ int nexprs; /* Length of hasexecparam[] */
+ int *subnode_map; /* subnode 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. */
+ bool do_initial_prune; /* true if pruning should be performed
+ * during executor startup. */
+ bool do_exec_prune; /* true if pruning should be performed during
+ * executor run. */
+ Bitmapset *execparamids; /* All PARAM_EXEC Param IDs in pruning_steps */
+} PartitionPruneInfo;
+
+/*
+ * Abstract Node type for partition pruning steps (there are no concrete
+ * Nodes of this type).
+ *
+ * step_id is the global identifier of the step within its pruning context.
+ */
+typedef struct PartitionPruneStep
+{
+ NodeTag type;
+ int step_id;
+} PartitionPruneStep;
+
+/*
+ * PartitionPruneStepOp - Information to prune using a set of mutually AND'd
+ * OpExpr clauses
+ *
+ * This contains information extracted from up to partnatts OpExpr clauses,
+ * where partnatts is the number of partition key columns. 'opstrategy' is the
+ * 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
+ * partition bounds. Both 'exprs' and 'cmpfns' contain the same number of
+ * 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
+ * 'opstrategy'. For example, if it were equality, we'd return just the
+ * partition that would contain that key or a set of partitions if the key
+ * didn't consist of all partitioning columns. For non-equality strategies,
+ * we'd need to include other partitions as appropriate.
+ *
+ * 'nullkeys' is the set containing the offset of the partition keys (0 to
+ * partnatts - 1) that were matched to an IS NULL clause. This is only
+ * considered for hash partitioning as we need to pass which keys are null
+ * to the hash partition bound search function. It is never possible to
+ * have an expression be present in 'exprs' for a given partition key and
+ * the corresponding bit set in 'nullkeys'.
+ */
+typedef struct PartitionPruneStepOp
+{
+ PartitionPruneStep step;
+
+ StrategyNumber opstrategy;
+ List *exprs;
+ List *cmpfns;
+ Bitmapset *nullkeys;
+} PartitionPruneStepOp;
+
+/*
+ * PartitionPruneStepCombine - Information to prune using a BoolExpr clause
+ *
+ * For BoolExpr clauses, we combine the set of partitions determined for each
+ * of the argument clauses.
+ */
+typedef enum PartitionPruneCombineOp
+{
+ PARTPRUNE_COMBINE_UNION,
+ PARTPRUNE_COMBINE_INTERSECT
+} PartitionPruneCombineOp;
+
+typedef struct PartitionPruneStepCombine
+{
+ PartitionPruneStep step;
+
+ PartitionPruneCombineOp combineOp;
+ List *source_stepids;
+} PartitionPruneStepCombine;
+
+
+/*
* Plan invalidation info
*
* We track the objects on which a PlannedStmt depends in two ways:
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index ef297cfaeda..1b4b0d75afa 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -18,7 +18,6 @@
#define PRIMNODES_H
#include "access/attnum.h"
-#include "access/stratnum.h"
#include "nodes/bitmapset.h"
#include "nodes/pg_list.h"
@@ -1507,107 +1506,4 @@ typedef struct OnConflictExpr
List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */
} OnConflictExpr;
-
-/*
- * Node types to represent a partition pruning step.
- */
-
-/*
- * The base Node type. step_id is the global identifier of a given step
- * within a given pruning context.
- */
-typedef struct PartitionPruneStep
-{
- NodeTag type;
- int step_id;
-} PartitionPruneStep;
-
-/*----------
- * PartitionPruneStepOp - Information to prune using a set of mutually AND'd
- * OpExpr clauses
- *
- * This contains information extracted from up to partnatts OpExpr clauses,
- * where partnatts is the number of partition key columns. 'opstrategy' is the
- * 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
- * partition bounds. Both 'exprs' and 'cmpfns' contain the same number of
- * 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
- * 'opstrategy'. For example, if it were equality, we'd return just the
- * partition that would contain that key or a set of partitions if the key
- * didn't consist of all partitioning columns. For non-equality strategies,
- * we'd need to include other partitions as appropriate.
- *
- * 'nullkeys' is the set containing the offset of the partition keys (0 to
- * partnatts - 1) that were matched to an IS NULL clause. This is only
- * considered for hash partitioning as we need to pass which keys are null
- * to the hash partition bound search function. It is never possible to
- * have an expression be present in 'exprs' for a given partition key and
- * the corresponding bit set in 'nullkeys'.
- *----------
- */
-typedef struct PartitionPruneStepOp
-{
- PartitionPruneStep step;
-
- StrategyNumber opstrategy;
- List *exprs;
- List *cmpfns;
- Bitmapset *nullkeys;
-} PartitionPruneStepOp;
-
-/*----------
- * PartitionPruneStepCombine - Information to prune using a BoolExpr clause
- *
- * For BoolExpr clauses, we combine the set of partitions determined for each
- * of its argument clauses.
- *----------
- */
-typedef enum PartitionPruneCombineOp
-{
- PARTPRUNE_COMBINE_UNION,
- PARTPRUNE_COMBINE_INTERSECT
-} PartitionPruneCombineOp;
-
-typedef struct PartitionPruneStepCombine
-{
- PartitionPruneStep step;
-
- PartitionPruneCombineOp combineOp;
- List *source_stepids;
-} PartitionPruneStepCombine;
-
-/*----------
- * PartitionPruneInfo - Details required to allow the executor to prune
- * 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.
- *----------
- */
-typedef struct PartitionPruneInfo
-{
- NodeTag type;
- Oid reloid; /* Oid of partition rel */
- List *pruning_steps; /* List of PartitionPruneStep */
- Bitmapset *present_parts; /* Indexes of all partitions which subnodes
- * are present for. */
- int nparts; /* Length of subnode_map[] and subpart_map[] */
- int nexprs; /* Length of hasexecparam[] */
- int *subnode_map; /* subnode 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. */
- bool do_initial_prune; /* true if pruning should be performed
- * during executor startup. */
- bool do_exec_prune; /* true if pruning should be performed during
- * executor run. */
- Bitmapset *execparamids; /* All PARAM_EXEC Param IDs in pruning_steps */
-} PartitionPruneInfo;
-
#endif /* PRIMNODES_H */