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 1lEMrH-0002NK-J6 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Feb 2021 01:51:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEMrF-0006tg-Sj for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Feb 2021 01:51:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEMrF-0006s6-K0 for pgsql-hackers@lists.postgresql.org; Tue, 23 Feb 2021 01:51:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEMrC-0007So-4T for pgsql-hackers@lists.postgresql.org; Tue, 23 Feb 2021 01:51:24 +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 11N1pHWf3753635; Mon, 22 Feb 2021 20:51:17 -0500 From: Tom Lane To: Andres Freund cc: David Rowley , Konstantin Knizhnik , Andy Fan , Alvaro Herrera , PostgreSQL Developers Subject: Re: Hybrid Hash/Nested Loop joins and caching results from subplans In-reply-to: <20210223013911.xf2lhaz6pljuxsjj@alap3.anarazel.de> References: <4bbece40-d648-b6f9-a323-fcb8f4b45e78@postgrespro.ru> <20210223013911.xf2lhaz6pljuxsjj@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 22 Feb 2021 17:39:11 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3753633.1614045077.1@sss.pgh.pa.us> Date: Mon, 22 Feb 2021 20:51:17 -0500 Message-ID: <3753634.1614045077@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > Except for the annoying issue that that we pervasively use Lists as > expressions, I'd argue that we should actually cache "subtree > volatility" in Expr nodes, similar to the way we use OpExpr.opfuncid > etc. That'd allow us to make contain_volatile_functions() very cheap ... and completely break changing volatility with ALTER FUNCTION. The case of OpExpr.opfuncid is okay only because we don't provide a way to switch an operator's underlying function. (See also 9f1255ac8.) It'd certainly be desirable to reduce the number of duplicated function property lookups in the planner, but I'm not convinced that that is a good way to go about it. regards, tom lane