Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBd3T-00069Y-Vl for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Jul 2022 14:09:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oBd3S-0000XJ-TD for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Jul 2022 14:09:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBd3S-0000X5-K3 for pgsql-hackers@lists.postgresql.org; Wed, 13 Jul 2022 14:09:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBd3Q-0005Gp-Ed for pgsql-hackers@lists.postgresql.org; Wed, 13 Jul 2022 14:09:30 +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 26DE9N8V2217147; Wed, 13 Jul 2022 10:09:23 -0400 From: Tom Lane To: Richard Guo cc: Pg Hackers , "Finnerty, Jim" Subject: Re: Making Vars outer-join aware In-reply-to: References: <830269.1656693747@sss.pgh.pa.us> <1903934.1657031040@sss.pgh.pa.us> <553080.1657481916@sss.pgh.pa.us> <1515100.1657633061@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Wed, 13 Jul 2022 15:48:41 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2217145.1657721363.1@sss.pgh.pa.us> Date: Wed, 13 Jul 2022 10:09:23 -0400 Message-ID: <2217146.1657721363@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > But I'm not sure which is better, to evaluate the expression below or > above the outer join. It seems to me that if the size of base rel is > large and somehow the size of the joinrel is small, evaluation above the > outer join would win. And in the opposite case evaluation below the > outer join would be better. Reasonable question. But I think for the purposes of this patch, it's better to keep the old behavior as much as we can. People have probably relied on it while tuning queries. (I'm not saying it has to be *exactly* bug-compatible, but simple cases like your example probably should work the same.) regards, tom lane