renaming, phase 1
authorRobert Haas <rhaas@postgresql.org>
Wed, 16 Jul 2025 13:47:42 +0000 (09:47 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 16 Jul 2025 13:47:42 +0000 (09:47 -0400)
contrib/pg_plan_advice/pgpa_join.c
contrib/pg_plan_advice/pgpa_join.h
contrib/pg_plan_advice/pgpa_output.c
contrib/pg_plan_advice/pgpa_scan.c
contrib/pg_plan_advice/pgpa_walker.c
contrib/pg_plan_advice/pgpa_walker.h

index 392eea4dd2b12fbce95830ff773647044db4625a..65c13765dc3f4af46314cbd48e11b6c6775b91a7 100644 (file)
@@ -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);
index e7dabbae2f114a0866d03de8c06793806cac3827..58861eebfa62dd129d612dfb92977192b0d70af8 100644 (file)
@@ -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;
 
index 634cd75af52798d9a70a7506162e150739e5ba9e..4c637d6b14bfbbe89f14558322859704791dcd7c 100644 (file)
@@ -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)
        {
index 41686dd704a9d941748f59ec211f53516d031536..71e982f7e84b0e86bae4a37cf2893896ec740186 100644 (file)
 #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;
 }
index 3d20d6cc053bde02476bc0b7128cefebdffc1341..51c1ba74638aaa51b6a8221fbce7066c17778e28 100644 (file)
@@ -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);
        }
 
        /*
index f724e53801b2c167c8d177956c8f4c5b5cb2c646..d052563d2f44f586f89883b62336f7aed2d9eb81 100644 (file)
@@ -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;