summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2023-05-04 12:09:59 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2023-05-04 12:09:59 +0200
commit5472743d9e8583638a897b47558066167cc14583 (patch)
tree5c983ffbf40157062fe6922f1b0c448e8b7d011f /src/include
parent919c486a275bcdd83d2add77da87b6edbd91418c (diff)
downloadpostgresql-5472743d9e8583638a897b47558066167cc14583.tar.gz
Revert "Move PartitionPruneInfo out of plan nodes into PlannedStmt"
This reverts commit ec386948948c and its fixup 589bb816499e. This change was intended to support query planning avoiding acquisition of locks on partitions that were going to be pruned; however, the overall project took a different direction at [1] and this bit is no longer needed. Put things back the way they were as agreed in [2], to avoid unnecessary complexity. Discussion: [1] https://postgr.es/m/4191508.1674157166@sss.pgh.pa.us Discussion: [2] https://postgr.es/m/20230502175409.kcoirxczpdha26wt@alvherre.pgsql
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/executor/execPartition.h4
-rw-r--r--src/include/nodes/execnodes.h1
-rw-r--r--src/include/nodes/pathnodes.h6
-rw-r--r--src/include/nodes/plannodes.h14
-rw-r--r--src/include/partitioning/partprune.h8
6 files changed, 11 insertions, 24 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 44d7e521bd..a091f2ca26 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202304211
+#define CATALOG_VERSION_NO 202305041
#endif
diff --git a/src/include/executor/execPartition.h b/src/include/executor/execPartition.h
index ee487e42dd..15ec869ac8 100644
--- a/src/include/executor/execPartition.h
+++ b/src/include/executor/execPartition.h
@@ -123,9 +123,9 @@ typedef struct PartitionPruneState
extern PartitionPruneState *ExecInitPartitionPruning(PlanState *planstate,
int n_total_subplans,
- int part_prune_index,
- Bitmapset *root_parent_relids,
+ PartitionPruneInfo *pruneinfo,
Bitmapset **initially_valid_subplans);
extern Bitmapset *ExecFindMatchingSubPlans(PartitionPruneState *prunestate,
bool initial_prune);
+
#endif /* EXECPARTITION_H */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 695ff056ba..61b3517906 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -623,7 +623,6 @@ typedef struct EState
* ExecRowMarks, or NULL if none */
List *es_rteperminfos; /* List of RTEPermissionInfo */
PlannedStmt *es_plannedstmt; /* link to top of plan tree */
- List *es_part_prune_infos; /* PlannedStmt.partPruneInfos */
const char *es_sourceText; /* Source text from QueryDesc */
JunkFilter *es_junkFilter; /* top-level junk filter, if any */
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index cf28416da8..7d4f24d250 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -125,9 +125,6 @@ typedef struct PlannerGlobal
/* "flat" list of AppendRelInfos */
List *appendRelations;
- /* List of PartitionPruneInfo contained in the plan */
- List *partPruneInfos;
-
/* OIDs of relations the plan depends on */
List *relationOids;
@@ -547,9 +544,6 @@ struct PlannerInfo
/* Does this query modify any partition key columns? */
bool partColsUpdated;
-
- /* PartitionPruneInfos added in this query's plan. */
- List *partPruneInfos;
};
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 659bd05c0c..1b787fe031 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -70,9 +70,6 @@ typedef struct PlannedStmt
struct Plan *planTree; /* tree of Plan nodes */
- List *partPruneInfos; /* List of PartitionPruneInfo contained in the
- * plan */
-
List *rtable; /* list of RangeTblEntry nodes */
List *permInfos; /* list of RTEPermissionInfo nodes for rtable
@@ -276,8 +273,8 @@ typedef struct Append
*/
int first_partial_plan;
- /* Index to PlannerInfo.partPruneInfos or -1 if no run-time pruning */
- int part_prune_index;
+ /* Info for run-time subplan pruning; NULL if we're not doing that */
+ struct PartitionPruneInfo *part_prune_info;
} Append;
/* ----------------
@@ -311,8 +308,8 @@ typedef struct MergeAppend
/* NULLS FIRST/LAST directions */
bool *nullsFirst pg_node_attr(array_size(numCols));
- /* Index to PlannerInfo.partPruneInfos or -1 if no run-time pruning */
- int part_prune_index;
+ /* Info for run-time subplan pruning; NULL if we're not doing that */
+ struct PartitionPruneInfo *part_prune_info;
} MergeAppend;
/* ----------------
@@ -1414,8 +1411,6 @@ typedef struct PlanRowMark
* Then, since an Append-type node could have multiple partitioning
* hierarchies among its children, we have an unordered List of those Lists.
*
- * root_parent_relids RelOptInfo.relids of the relation to which the parent
- * plan node and this PartitionPruneInfo node belong
* prune_infos List of Lists containing PartitionedRelPruneInfo nodes,
* one sublist per run-time-prunable partition hierarchy
* appearing in the parent plan node's subplans.
@@ -1428,7 +1423,6 @@ typedef struct PartitionPruneInfo
pg_node_attr(no_equal, no_query_jumble)
NodeTag type;
- Bitmapset *root_parent_relids;
List *prune_infos;
Bitmapset *other_subplans;
} PartitionPruneInfo;
diff --git a/src/include/partitioning/partprune.h b/src/include/partitioning/partprune.h
index c0d6889d47..8636e04e37 100644
--- a/src/include/partitioning/partprune.h
+++ b/src/include/partitioning/partprune.h
@@ -70,10 +70,10 @@ typedef struct PartitionPruneContext
#define PruneCxtStateIdx(partnatts, step_id, keyno) \
((partnatts) * (step_id) + (keyno))
-extern int make_partition_pruneinfo(struct PlannerInfo *root,
- struct RelOptInfo *parentrel,
- List *subpaths,
- List *prunequal);
+extern PartitionPruneInfo *make_partition_pruneinfo(struct PlannerInfo *root,
+ struct RelOptInfo *parentrel,
+ List *subpaths,
+ List *prunequal);
extern Bitmapset *prune_append_rel_partitions(struct RelOptInfo *rel);
extern Bitmapset *get_matching_partitions(PartitionPruneContext *context,
List *pruning_steps);