Re: CTE inlining

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ilya Shkuratov <motr(dot)ilya(at)ya(dot)ru>, Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Fetter <david(at)fetter(dot)org>, Claudio Freire <klaussfreire(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CTE inlining
Date: 2017-05-12 20:39:46
Message-ID: 20170512203946.GA31631@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 9, 2017 at 05:14:19PM -0400, Tom Lane wrote:
> Ilya Shkuratov <motr(dot)ilya(at)ya(dot)ru> writes:
> > Ok, it seems that most people in discussion are agree that removing optimization
> > fence is a right thing to do.
> > Nonetheless I still hoping to discuss the algorithm and its implementation.
>
> Yeah, so far we've mainly discussed whether to do that and how to control
> it, not what the actual results would be.

To summarize, it seems we have two options if we want to add fence
control to CTEs:

1. add INLINE to disable the CTE fence
2. add MATERIALIZE to enable the CTE fence

or some other keywords. I think most people prefer #2 because:

* most users writing queries prefer #2
* most users assume full optimization and it seems natural to turn
_off_ an optimization via a keyword
* while some queries can be inlined, all queries can be materialized,
so doing #1 means INLINE would be only a preference, which could be
confusing

Anyway, I am very glad we are considering addressing this in PG 11.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-05-12 20:48:01 Re: WITH clause in CREATE STATISTICS
Previous Message Tom Lane 2017-05-12 20:36:30 Re: WITH clause in CREATE STATISTICS