Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fi7Bl-0003Gu-Tw for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jul 2018 23:57:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fi7Bj-0004o0-UZ for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jul 2018 23:57:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fi7Bj-0004nt-KF for pgsql-hackers@lists.postgresql.org; Tue, 24 Jul 2018 23:57:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fi7Bh-000193-8I for pgsql-hackers@postgresql.org; Tue, 24 Jul 2018 23:57:54 +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 w6ONvnS4021959; Tue, 24 Jul 2018 19:57:49 -0400 From: Tom Lane To: Andres Freund cc: Jeremy Finzel , Andrew Gierth , pgsql-hackers@postgresql.org Subject: Re: Early WIP/PoC for inlining CTEs In-reply-to: <20180724235416.c7c4az6kjxyszkgt@alap3.anarazel.de> References: <87sh48ffhb.fsf@news-spur.riddles.org.uk> <20180724231010.quiaae5qyfrreiyj@alap3.anarazel.de> <21487.1532476159@sss.pgh.pa.us> <20180724235416.c7c4az6kjxyszkgt@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 24 Jul 2018 16:54:16 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21957.1532476669.1@sss.pgh.pa.us> Date: Tue, 24 Jul 2018 19:57:49 -0400 Message-ID: <21958.1532476669@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-07-24 19:49:19 -0400, Tom Lane wrote: >> However, a singly-referenced SELECT CTE could reasonably be treated as >> equivalent to a sub-select-in-FROM, and then you would have the same >> mechanisms for preventing inlining as you do for those cases, >> e.g. OFFSET 0. And sticking in OFFSET 0 would be backwards-compatible >> too: your code would still work the same in older releases, unlike if >> we invent new syntax for this. > I still think this is just doubling down on prior mistakes. Not following what you think a better alternative is? I'd be the first to agree that OFFSET 0 is a hack, but people are used to it. Assuming that we go for inline-by-default for at least some cases, there's a separate discussion to be had about whether it's worth making a planner-control GUC to force the old behavior. I'm not very excited about that, but I bet some people will be. regards, tom lane