From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jeremy Finzel <finzelj(at)gmail(dot)com>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Early WIP/PoC for inlining CTEs |
Date: | 2018-07-25 00:04:10 |
Message-ID: | 20180725000410.jf57diuvyouvxpd5@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2018-07-24 19:57:49 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> 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?
An explicit keyword controlling the behaviour. WITH ... foo AS
MATERIALIZED (query) or whatnot.
> I'd be the first to agree that OFFSET 0 is a hack, but people are used
> to it.
So are they to CTEs being blocking.
Consider e.g. the case of being able to push down constraints into CTEs
(which have been inlined to allow for that). Even in queries with a
non-0 OFFSET you can push down in a number of cases, making CTE inlining
useful. You can't tack on an OFFSET 0 controlling that, without going
for a superflous subquery that just has an OFFSET 0, which is fairly
ridiculous. What if we learn to inline subqueries with some offsets?
> 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.
Yea, I am not either. I think we shouldn't go for it.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-07-25 00:04:58 | Re: Early WIP/PoC for inlining CTEs |
Previous Message | Tom Lane | 2018-07-24 23:57:49 | Re: Early WIP/PoC for inlining CTEs |