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 1lEQUL-0005jQ-9P for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Feb 2021 05:44:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEQUI-0007MJ-4b for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Feb 2021 05:43:58 +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 1lEQUH-0007J7-UG for pgsql-hackers@lists.postgresql.org; Tue, 23 Feb 2021 05:43:57 +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 1lEQUE-0001Ol-GM for pgsql-hackers@lists.postgresql.org; Tue, 23 Feb 2021 05:43:56 +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 11N5hlf23795227; Tue, 23 Feb 2021 00:43:48 -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: <20210223020105.kz3rlairv3gjojys@alap3.anarazel.de> References: <4bbece40-d648-b6f9-a323-fcb8f4b45e78@postgrespro.ru> <20210223013911.xf2lhaz6pljuxsjj@alap3.anarazel.de> <3753634.1614045077@sss.pgh.pa.us> <20210223020105.kz3rlairv3gjojys@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 22 Feb 2021 18:01:05 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3795225.1614059027.1@sss.pgh.pa.us> Date: Tue, 23 Feb 2021 00:43:47 -0500 Message-ID: <3795226.1614059027@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > We could add a wrapper node around "planner expressions" that stores > metadata about them during planning, without those properties leaking > over expressions used at other times. E.g. having > preprocess_expression() return a PlannerExpr that that points to the > expression as preprocess_expression returns it today. That'd make it > easy to cache information like volatility. But it also seems > prohibitively invasive :(. I doubt it's that bad. We could cache such info in RestrictInfo for quals, or PathTarget for tlists, without much new notational overhead. That doesn't cover everything the planner deals with of course, but it would cover enough that you'd be chasing pretty small returns to worry about more. regards, tom lane