Thank you to Julien Rouhaud and Tender Wang for the reviews.

Julien's detailed guide has proven to be incredibly helpful, and I am
truly grateful for it.
Thank you so much for providing such valuable guidance!

I have initiated a new commitfest:
https://commitfest.postgresql.org/43/4346/

Furthermore, I have attached a patch that improves the code by moving
the initialization of "other_rels_list" outside the if branching.

Perhaps Tom Lane would be interested in reviewing this minor change as well?
From 5b038577cf4f8acdc094d6e41d3891b559016cae Mon Sep 17 00:00:00 2001
From: DouEnergy <douene...@protonmail.com>
Date: Tue, 6 Jun 2023 15:30:14 +0800
Subject: [PATCH v2] Improve left deep tree dp algorithm's readability

---
 src/backend/optimizer/path/joinrels.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/optimizer/path/joinrels.c 
b/src/backend/optimizer/path/joinrels.c
index 2feab2184f..a283e574f3 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -109,14 +109,14 @@ join_search_one_level(PlannerInfo *root, int level)
                        List       *other_rels_list;
                        ListCell   *other_rels;
 
+                       other_rels_list = joinrels[1];
+
                        if (level == 2)         /* consider remaining initial 
rels */
                        {
-                               other_rels_list = joinrels[level - 1];
                                other_rels = lnext(other_rels_list, r);
                        }
                        else                            /* consider all initial 
rels */
                        {
-                               other_rels_list = joinrels[1];
                                other_rels = list_head(other_rels_list);
                        }
 
-- 
2.37.1 (Apple Git-137.1)

Reply via email to