Re: [HACKERS] CTE inlining - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: [HACKERS] CTE inlining
Date
Msg-id b9ff8365-95af-e1ed-3c41-f2a778b78d77@proxel.se
Whole thread Raw
In response to Re: [HACKERS] CTE inlining  (David Fetter <david@fetter.org>)
Responses Re: [HACKERS] CTE inlining  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: [HACKERS] CTE inlining  (Corey Huinker <corey.huinker@gmail.com>)
Re: [HACKERS] CTE inlining  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
On 05/01/2017 04:17 PM, David Fetter wrote:
>> Maybe we could allow a "decorator" that would tell the planner the CTE
>> could be inlined?
>>
>>     WITH INLINE mycte AS ( ...)
>
> +1 for a decorator, -1 for this one.

I am not sure I like decorators since this means adding an ad hoc query 
hint directly into the SQL syntax which is something which I requires 
serious consideration.

> We already have an explicit optimization fence with OFFSET 0, and I
> think making optimization fences explicit is how we should continue.
> I'd be more in favor of something along the lines of
>
>     WITH FENCED        /* Somewhat fuzzy.  What fence? */
>     or
>     WITH AT_MOST_ONCE  /* Clearer, but not super precise */
>     or
>     WITH UNIQUE_ATOMIC /* More descriptive, but not super clear without the docs in hand */
>
> or something along that line.

What about WITH MATERIALIZED, borrowing from the MySQL terminology 
"materialized subquery"?

Andreas



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] PG 10 release notes
Next
From: "David G. Johnston"
Date:
Subject: Re: [HACKERS] CTE inlining