address XXX by addingg comments
authorRobert Haas <rhaas@postgresql.org>
Wed, 16 Jul 2025 20:19:13 +0000 (16:19 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 16 Jul 2025 20:19:13 +0000 (16:19 -0400)
contrib/pg_plan_advice/pgpa_join.c

index f6722f1594c9e73a6f7f95fddff0f8b1bf4acc9e..dd5c2411ae21fef270c22d6efafcefa13edbb302 100644 (file)
@@ -84,7 +84,22 @@ pgpa_create_join_unroller(void)
 /*
  * Unroll one level of an unrollable join tree.
  *
- * XXX. More comments.
+ * Our basic goal here is to unroll join trees as they occur in the Plan
+ * tree into a simpler and more regular structure that we can more easily
+ * use for further processing. Unrolling is outer-deep, so if the plan tree
+ * has Join1(Join2(A,B),Join3(C,D)), the same join unroller object should be
+ * used for Join1 and Join2, but a different one will be needed for Join3,
+ * since that involves a join within the *inner* side of another join.
+ *
+ * pgpa_plan_walker creates a "top level" join unroller object when it
+ * encounters a join in a portion of the plan tree in which no join unroller
+ * is already active. From there, this function is responsible for determing
+ * to what portion of the plan tree that join unroller applies, and for
+ * creating any subordinate join unroller objects that are needed as a result
+ * of non-outer-deep join trees. We do this by returning the join unroller
+ * objects that should be used for further traversal of the outer and inner
+ * subtrees of the current plan node via *outer_join_unroller and
+ * *inner_join_unroller, respectively.
  */
 void
 pgpa_unroll_join(pgpa_plan_walker_context *walker, Plan *plan,