Re: Early WIP/PoC for inlining CTEs - Mailing list pgsql-hackers

From Nico Williams
Subject Re: Early WIP/PoC for inlining CTEs
Date
Msg-id 20180725153205.GM5695@localhost
Whole thread Raw
In response to Re: Early WIP/PoC for inlining CTEs  (David Fetter <david@fetter.org>)
Responses Re: Early WIP/PoC for inlining CTEs
List pgsql-hackers
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
-- 


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Missing pg_control crashes postmaster
Next
From: Tom Lane
Date:
Subject: Re: Missing pg_control crashes postmaster