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 1u20ZH-00BXxE-Sx for pgsql-docs@arkaria.postgresql.org; Tue, 08 Apr 2025 04:28:11 +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 1u20ZG-005h3Y-7X for pgsql-docs@arkaria.postgresql.org; Tue, 08 Apr 2025 04:28:10 +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 1u20ZF-005h3J-W5 for pgsql-docs@lists.postgresql.org; Tue, 08 Apr 2025 04:28:10 +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.96) (envelope-from ) id 1u20ZE-003bUe-1p for pgsql-docs@postgresql.org; Tue, 08 Apr 2025 04:28:09 +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 5384S7j33887652; Tue, 8 Apr 2025 00:28:07 -0400 From: Tom Lane To: Zeyuan Hu cc: pgsql-docs@postgresql.org Subject: Re: Possible documentation inaccuracy in optimizer README In-reply-to: References: Comments: In-reply-to Zeyuan Hu message dated "Mon, 07 Apr 2025 19:32:01 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3887650.1744086487.1@sss.pgh.pa.us> Date: Tue, 08 Apr 2025 00:28:07 -0400 Message-ID: <3887651.1744086487@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Zeyuan Hu writes: > In https://github.com/postgres/postgres/tree/master/src/backend/optimizer, > there are two examples on the dynamic programming (DP) algorithm used in > the optimizer, which I think > have some inaccuracy: You're right that these examples do not consider the effects of clauses generated by the EquivalenceClass machinery. But I don't think the exposition would be improved by mentioning that here. The point of these examples is that we don't consider joining rels that have no linking clauses at all. We could possibly avoid the inaccuracy by making the examples use some other operators that are not equijoins. But I wonder if that would not be more confusing rather than less so. regards, tom lane