summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2025-07-16 13:47:42 +0000
committerRobert Haas2025-07-16 13:47:42 +0000
commitefc658c775a6e5f4542fa51a164dfa0fb2ff2b17 (patch)
treea40e3ec938a4f5fe560bf9378ebabd14a7ff0dfe
parent30827e8b95c8e75e77d35b6f7451f88b1c6bcbf6 (diff)
renaming, phase 1
-rw-r--r--contrib/pg_plan_advice/pgpa_join.c6
-rw-r--r--contrib/pg_plan_advice/pgpa_join.h2
-rw-r--r--contrib/pg_plan_advice/pgpa_output.c42
-rw-r--r--contrib/pg_plan_advice/pgpa_scan.c29
-rw-r--r--contrib/pg_plan_advice/pgpa_walker.c12
-rw-r--r--contrib/pg_plan_advice/pgpa_walker.h3
6 files changed, 45 insertions, 49 deletions
diff --git a/contrib/pg_plan_advice/pgpa_join.c b/contrib/pg_plan_advice/pgpa_join.c
index 392eea4dd2..65c13765dc 100644
--- a/contrib/pg_plan_advice/pgpa_join.c
+++ b/contrib/pg_plan_advice/pgpa_join.c
@@ -495,8 +495,7 @@ pgpa_fix_scan_or_clump_member(PlannedStmt *pstmt, pgpa_join_member *member)
*/
if (bms_membership(member->elided_node->relids) == BMS_MULTIPLE)
member->clump_join =
- pgpa_build_clumped_join(pstmt, member->plan,
- member->elided_node);
+ pgpa_build_scan(pstmt, member->plan, member->elided_node);
else
member->rti = bms_singleton_member(member->elided_node->relids);
}
@@ -508,8 +507,7 @@ pgpa_fix_scan_or_clump_member(PlannedStmt *pstmt, pgpa_join_member *member)
*/
if (pgpa_get_join_class(member->plan) == PGPA_CLUMPED_JOIN)
member->clump_join =
- pgpa_build_clumped_join(pstmt, member->plan,
- member->elided_node);
+ pgpa_build_scan(pstmt, member->plan, member->elided_node);
else
{
member->rti = pgpa_scanrelid(member->plan);
diff --git a/contrib/pg_plan_advice/pgpa_join.h b/contrib/pg_plan_advice/pgpa_join.h
index e7dabbae2f..58861eebfa 100644
--- a/contrib/pg_plan_advice/pgpa_join.h
+++ b/contrib/pg_plan_advice/pgpa_join.h
@@ -60,7 +60,7 @@ typedef struct
Plan *plan;
ElidedNode *elided_node;
Index rti;
- struct pgpa_clumped_join *clump_join;
+ struct pgpa_scan *clump_join;
pgpa_unrolled_join *unrolled_join;
} pgpa_join_member;
diff --git a/contrib/pg_plan_advice/pgpa_output.c b/contrib/pg_plan_advice/pgpa_output.c
index 634cd75af5..4c637d6b14 100644
--- a/contrib/pg_plan_advice/pgpa_output.c
+++ b/contrib/pg_plan_advice/pgpa_output.c
@@ -20,7 +20,7 @@ typedef struct pgpa_output_context
const char **rt_identifiers;
StringInfo buf;
List *unrolled_joins[NUM_PGPA_JOIN_STRATEGY];
- List *clumped_joins[NUM_PGPA_CLUMP_JOIN_STRATEGY];
+ List *scans[NUM_PGPA_CLUMP_JOIN_STRATEGY];
List *query_features[NUM_PGPA_QF_TYPES];
int wrap_column;
} pgpa_output_context;
@@ -61,15 +61,14 @@ pgpa_output_advice(StringInfo buf, pgpa_plan_walker_context *walker,
context.wrap_column = 79; /* XXX */
/*
- * Put all the top-level clumped joins for each strategy into a single
- * list.
+ * Put all the top-level scans for each strategy into a single list.
*/
- foreach(lc, walker->clumped_joins)
+ foreach(lc, walker->scans)
{
- pgpa_clumped_join *cjoin = lfirst(lc);
+ pgpa_scan *scan = lfirst(lc);
- context.clumped_joins[cjoin->strategy] =
- lappend(context.clumped_joins[cjoin->strategy], cjoin->relids);
+ context.scans[scan->strategy] =
+ lappend(context.scans[scan->strategy], scan->relids);
}
/*
@@ -82,8 +81,9 @@ pgpa_output_advice(StringInfo buf, pgpa_plan_walker_context *walker,
* which is totally different from JOIN_ORDER(a b) and JOIN_ORDER(c d).
*
* As a side effect, the calls to pgpa_output_unrolled_join() will
- * add to the context.clumped_joins[] and context.unrolled_joins[] lists,
- * which will be important for emitting join strategy advice further down.
+ * add to the context.unrolled_joins[] lists and context.scans[] lists,
+ * which will be important for emitting join and scan strategy advice
+ * further down.
*/
foreach(lc, walker->unrolled_joins)
{
@@ -137,8 +137,8 @@ pgpa_output_advice(StringInfo buf, pgpa_plan_walker_context *walker,
}
/*
- * Emit just one piece of advice for each clumped-join strategy that is
- * used at least once in the query.
+ * Emit just one piece of advice for each scan strategy that is used at
+ * least once in the query.
*
* XXX. It's not entirely clear that emitting DEGENERATE() advice is
* useful at all, since there is no real decision to be made: you can't
@@ -153,14 +153,14 @@ pgpa_output_advice(StringInfo buf, pgpa_plan_walker_context *walker,
char *cstrategy = pgpa_cstring_join_clump_strategy(c);
bool first = true;
- if (context.clumped_joins[c] == NIL)
+ if (context.scans[c] == NIL)
continue;
if (buf->len > 0)
appendStringInfoChar(buf, '\n');
appendStringInfo(buf, "%s(", cstrategy);
- foreach(lc, context.clumped_joins[c])
+ foreach(lc, context.scans[c])
{
Bitmapset *relids = lfirst(lc);
@@ -248,8 +248,8 @@ pgpa_output_advice(StringInfo buf, pgpa_plan_walker_context *walker,
* then the inner members one by one, as part of JOIN_ORDER() advice.
*
* As we visit members, we add to the context->unrolled_joins[] and
- * context->clumped_joins[] lists. The former updates are done by this
- * function directly, and the latter via pgpa_output_join_member.
+ * context->scans[] lists. The former updates are done by this function
+ * directly, and the latter via pgpa_output_join_member.
*/
static void
pgpa_output_unrolled_join(pgpa_output_context *context,
@@ -280,8 +280,8 @@ pgpa_output_unrolled_join(pgpa_output_context *context,
/*
* Output a single member of an unrolled join as part of JOIN_ORDER() advice.
*
- * If that member happens to be a clumped join, also add it to the appropriate
- * context->clump_joins[] list.
+ * If that member happens to be a scan, also add it to the appropriate
+ * context->scans[] list.
*/
static void
pgpa_output_join_member(pgpa_output_context *context,
@@ -289,13 +289,13 @@ pgpa_output_join_member(pgpa_output_context *context,
{
if (member->clump_join != NULL)
{
- pgpa_clumped_join *cjoin = member->clump_join;
+ pgpa_scan *scan = member->clump_join;
appendStringInfoChar(context->buf, '{');
- pgpa_output_relations(context, context->buf, cjoin->relids);
+ pgpa_output_relations(context, context->buf, scan->relids);
appendStringInfoChar(context->buf, '}');
- context->clumped_joins[cjoin->strategy] =
- lappend(context->clumped_joins[cjoin->strategy], cjoin->relids);
+ context->scans[scan->strategy] =
+ lappend(context->scans[scan->strategy], scan->relids);
}
else if (member->unrolled_join != NULL)
{
diff --git a/contrib/pg_plan_advice/pgpa_scan.c b/contrib/pg_plan_advice/pgpa_scan.c
index 41686dd704..71e982f7e8 100644
--- a/contrib/pg_plan_advice/pgpa_scan.c
+++ b/contrib/pg_plan_advice/pgpa_scan.c
@@ -18,20 +18,19 @@
#include "parser/parsetree.h"
/*
- * Build a pgpa_clumped_join object for a Plan node.
+ * Build a pgpa_scan object for a Plan node.
*
* If there is at least one ElidedNode for this plan node, pass the uppermost
* one as elided_node, else pass NULL.
*/
-pgpa_clumped_join *
-pgpa_build_clumped_join(PlannedStmt *pstmt, Plan *plan,
- ElidedNode *elided_node)
+pgpa_scan *
+pgpa_build_scan(PlannedStmt *pstmt, Plan *plan, ElidedNode *elided_node)
{
- pgpa_clumped_join *clump = palloc(sizeof(pgpa_clumped_join));
+ pgpa_scan *scan = palloc(sizeof(pgpa_scan));
Bitmapset *relids = NULL;
int rti = -1;
- clump->plan = plan;
+ scan->plan = plan;
if (elided_node != NULL)
{
@@ -47,7 +46,7 @@ pgpa_build_clumped_join(PlannedStmt *pstmt, Plan *plan,
Assert(bms_membership(elided_node->relids) == BMS_MULTIPLE);
relids = elided_node->relids;
if (elided_type == T_Append || elided_type == T_MergeAppend)
- clump->strategy = JSTRAT_CLUMP_PARTITIONWISE;
+ scan->strategy = JSTRAT_CLUMP_PARTITIONWISE;
else
elog(ERROR, "unexpected elided node type");
}
@@ -58,13 +57,13 @@ pgpa_build_clumped_join(PlannedStmt *pstmt, Plan *plan,
relids = pgpa_relids(plan);
if (IsA(plan, Result))
- clump->strategy = JSTRAT_CLUMP_DEGENERATE;
+ scan->strategy = JSTRAT_CLUMP_DEGENERATE;
else if (IsA(plan, ForeignScan))
- clump->strategy = JSTRAT_CLUMP_FOREIGN;
+ scan->strategy = JSTRAT_CLUMP_FOREIGN;
else if (IsA(plan, Append))
- clump->strategy = JSTRAT_CLUMP_PARTITIONWISE;
+ scan->strategy = JSTRAT_CLUMP_PARTITIONWISE;
else if (IsA(plan, MergeAppend))
- clump->strategy = JSTRAT_CLUMP_PARTITIONWISE;
+ scan->strategy = JSTRAT_CLUMP_PARTITIONWISE;
else
elog(ERROR, "unexpected plan type");
}
@@ -74,13 +73,13 @@ pgpa_build_clumped_join(PlannedStmt *pstmt, Plan *plan,
* and don't want them creating confusion later. (We always refer to
* groups of relations in terms of the relation RTIs, not the join RTIs.)
*/
- clump->relids = NULL;
+ scan->relids = NULL;
while ((rti = bms_next_member(relids, rti)) >= 0)
{
RangeTblEntry *rte = rt_fetch(rti, pstmt->rtable);
if (rte->rtekind != RTE_JOIN)
- clump->relids = bms_add_member(clump->relids, rti);
+ scan->relids = bms_add_member(scan->relids, rti);
}
/*
@@ -88,7 +87,7 @@ pgpa_build_clumped_join(PlannedStmt *pstmt, Plan *plan,
* multiple RTIs -- and even after removing the join RTIs, that should
* still be the case.
*/
- Assert(bms_membership(clump->relids) == BMS_MULTIPLE);
+ Assert(bms_membership(scan->relids) == BMS_MULTIPLE);
- return clump;
+ return scan;
}
diff --git a/contrib/pg_plan_advice/pgpa_walker.c b/contrib/pg_plan_advice/pgpa_walker.c
index 3d20d6cc05..51c1ba7463 100644
--- a/contrib/pg_plan_advice/pgpa_walker.c
+++ b/contrib/pg_plan_advice/pgpa_walker.c
@@ -111,10 +111,10 @@ pgpa_plan_walker(pgpa_plan_walker_context *walker, Plan *plan,
{
if (bms_membership(n->relids) == BMS_MULTIPLE)
{
- pgpa_clumped_join *cjoin;
+ pgpa_scan *scan;
- cjoin = pgpa_build_clumped_join(walker->pstmt, plan, n);
- walker->clumped_joins = lappend(walker->clumped_joins, cjoin);
+ scan = pgpa_build_scan(walker->pstmt, plan, n);
+ walker->scans = lappend(walker->scans, scan);
}
}
@@ -154,10 +154,10 @@ pgpa_plan_walker(pgpa_plan_walker_context *walker, Plan *plan,
*/
if (class == PGPA_CLUMPED_JOIN && join_unroll_level == 0)
{
- pgpa_clumped_join *cjoin;
+ pgpa_scan *scan;
- cjoin = pgpa_build_clumped_join(walker->pstmt, plan, NULL);
- walker->clumped_joins = lappend(walker->clumped_joins, cjoin);
+ scan = pgpa_build_scan(walker->pstmt, plan, NULL);
+ walker->scans = lappend(walker->scans, scan);
}
/*
diff --git a/contrib/pg_plan_advice/pgpa_walker.h b/contrib/pg_plan_advice/pgpa_walker.h
index f724e53801..d052563d2f 100644
--- a/contrib/pg_plan_advice/pgpa_walker.h
+++ b/contrib/pg_plan_advice/pgpa_walker.h
@@ -65,8 +65,7 @@ typedef struct pgpa_plan_walker_context
{
PlannedStmt *pstmt;
List *unrolled_joins;
- List *clumped_joins;
- List *gathered_joins;
+ List *scans;
List *query_features;
List *future_query_features;
} pgpa_plan_walker_context;