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 1fiLlv-0008JQ-Rq for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jul 2018 15:32:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiLlu-0001uh-5o for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jul 2018 15:32:14 +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 1fiLlt-0001uG-RY for pgsql-hackers@lists.postgresql.org; Wed, 25 Jul 2018 15:32:13 +0000 Received: from smtp13.dreamhost.com ([64.90.62.182] helo=pdx1-sub0-mail-a4.g.dreamhost.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiLlr-0004gk-1H for pgsql-hackers@postgresql.org; Wed, 25 Jul 2018 15:32:12 +0000 Received: from pdx1-sub0-mail-a4.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a4.g.dreamhost.com (Postfix) with ESMTP id 840F7805C2; Wed, 25 Jul 2018 08:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cryptonector.com; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=cryptonector.com; bh=bHR1Y1BYt6V29p 7AO6X/3yMou5k=; b=AwF1oovAxDG2owK4W6IO9eJxdp+PtzH/xW5ZoB/fz1449D yBy9yNu4IdJU8VIWEG37atG/hS+40jLB1J9kGkTKnKb+uA/ZCU0KxOO4JbTKr/s5 h6lBSA6C/0sgoJ2TncU1K5vDzPyOvYITss9aBsfxK1ixrxKXp0+rj9B4rRYX0= Received: from localhost (cpe-70-123-158-140.austin.res.rr.com [70.123.158.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by pdx1-sub0-mail-a4.g.dreamhost.com (Postfix) with ESMTPSA id F025E805E6; Wed, 25 Jul 2018 08:32:06 -0700 (PDT) Date: Wed, 25 Jul 2018 10:32:06 -0500 From: Nico Williams To: David Fetter Cc: Andrew Gierth , pgsql-hackers@postgresql.org Subject: Re: Early WIP/PoC for inlining CTEs Message-ID: <20180725153205.GM5695@localhost> References: <87sh48ffhb.fsf@news-spur.riddles.org.uk> <20180725054236.GB17411@fetter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180725054236.GB17411@fetter.org> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Jul 25, 2018 at 07:42:37AM +0200, David Fetter wrote: > Please find attached a version rebased atop 167075be3ab1547e18 with > what I believe are appropriate changes to regression test output. The > other changes to the regression tests output are somewhat puzzling, as > they change the actual results of queries. I've also attached both > the "leftover" diff and the files to which it should be applied. I think the SQL programmer needs some control over whether a CTE is: - a materialized view -- and therefore a barrier - a view (which can then be inlined by the optimizer) It is possible to add a keyword for this purpose in the WITH syntax: WITH VIEW (...) AS a_view , MATERIALIZED VIEW (...) AS a_barrier ...; This would be a lot like creating TEMP views, but without the catalog overhead. (I wonder how hard it would be to partiion the OID namespace into temp/persistent ranges so that temp schema elements need not be written into the catalog.) Nico --