Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gk9y4-00023c-Du for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jan 2019 15:52:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gk9y3-00041J-8E for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jan 2019 15:52:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gk9y2-00041B-UD for pgsql-hackers@lists.postgresql.org; Thu, 17 Jan 2019 15:52:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gk9y0-0001ik-KH for pgsql-hackers@postgresql.org; Thu, 17 Jan 2019 15:52:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x0HFqKfQ014327; Thu, 17 Jan 2019 10:52:20 -0500 From: Tom Lane To: Andreas Karlsson cc: Robert Haas , Andres Freund , Thomas Munro , Andrew Gierth , David Fetter , Pg Hackers Subject: Re: Early WIP/PoC for inlining CTEs In-reply-to: <00818be9-2f63-f584-efcd-d97ee0662905@proxel.se> References: <8810.1542402910@sss.pgh.pa.us> <87r2dxrw1z.fsf@news-spur.riddles.org.uk> <20190111181934.g5qig23o7rxubnjt@alap3.anarazel.de> <20190111190403.77ye7m5mxypxsf4l@alap3.anarazel.de> <00818be9-2f63-f584-efcd-d97ee0662905@proxel.se> Comments: In-reply-to Andreas Karlsson message dated "Thu, 17 Jan 2019 16:48:07 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14325.1547740339.1@sss.pgh.pa.us> Date: Thu, 17 Jan 2019 10:52:19 -0500 Message-ID: <14326.1547740339@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andreas Karlsson writes: > On 1/11/19 8:10 PM, Robert Haas wrote: >> WITH cte_name [[NOT] MATERIALIZED] AS (query) main_query... > Hm, when would one want "NOT MATERIALIZED"? I am not sure I see the > usefulness of forcing inlining other than if we by default do not inline > when a CTE is referenced multiple times. I'm also concerned about what we do if the user says NOT MATERIALIZED but there are semantic or implementation reasons not to inline. Either we throw an error or do something the user didn't expect, and neither is very nice. So I'm not in favor of having that option. regards, tom lane