Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rpD4a-005bqm-2o for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2024 20:07:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rpD4Z-004noH-30 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2024 20:07:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rpD4Y-004nnK-Pt for pgsql-hackers@lists.postgresql.org; Tue, 26 Mar 2024 20:07:02 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rpD4V-006aFV-39 for pgsql-hackers@postgresql.org; Tue, 26 Mar 2024 20:07:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 42QK6wQt3166038; Tue, 26 Mar 2024 16:06:58 -0400 From: Tom Lane To: Richard Guo cc: PostgreSQL-development Subject: Re: Remove some redundant set_cheapest() calls In-reply-to: References: Comments: In-reply-to Richard Guo message dated "Tue, 26 Mar 2024 19:02:48 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3166036.1711483618.1@sss.pgh.pa.us> Date: Tue, 26 Mar 2024 16:06:58 -0400 Message-ID: <3166037.1711483618@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > I happened to notice that the set_cheapest() calls in functions > set_namedtuplestore_pathlist() and set_result_pathlist() are redundant, > as we've centralized the set_cheapest() calls in set_rel_pathlist(). > Attached is a trivial patch to remove these calls. Agreed, and pushed. > BTW, I suspect that the set_cheapest() call in set_dummy_rel_pathlist() > is also redundant. The comment there says "This is redundant when we're > called from set_rel_size(), but not when called from elsewhere". I > doubt it. The other places where it is called are set_append_rel_size() > and set_subquery_pathlist(), both being called from set_rel_size(). So > set_cheapest() would ultimately be called in set_rel_pathlist(). I'm less convinced about changing this. I'd rather keep it consistent with mark_dummy_rel. regards, tom lane