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

From Gavin Flower
Subject Re: [HACKERS] CTE inlining
Date
Msg-id 2dab0187-42fe-3b43-eed9-921aca564ec2@archidevsys.co.nz
Whole thread Raw
In response to Re: [HACKERS] CTE inlining  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] CTE inlining  (Serge Rielau <serge@rielau.com>)
List pgsql-hackers
On 30/04/17 16:28, Tom Lane wrote:
> Craig Ringer <craig.ringer@2ndquadrant.com> writes:
>> - as you noted, it is hard to decide when it's worth inlining vs
>> materializing for CTE terms referenced more than once.
> [ raised eyebrow... ]  Please explain why the answer isn't trivially
> "never".
>
> There's already a pretty large hill to climb here in the way of
> breaking peoples' expectations about CTEs being optimization
> fences.  Breaking the documented semantics about CTEs being
> single-evaluation seems to me to be an absolute non-starter.
>
>             regards, tom lane
>
>
Could not each CTE be only evaluated once, but restricted (as far as is 
practicable) to the rows actually needed by the body of the SELECT?


Cheers,
Gavin




pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [HACKERS] delta relations in AFTER triggers
Next
From: tushar
Date:
Subject: Re: [HACKERS] statement_timeout is not working as expected withpostgres_fdw