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

From Andrew Gierth
Subject Re: Early WIP/PoC for inlining CTEs
Date
Msg-id 87y3bdckvu.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: Early WIP/PoC for inlining CTEs  (Andreas Karlsson <andreas@proxel.se>)
Responses Re: Early WIP/PoC for inlining CTEs  (David Fetter <david@fetter.org>)
List pgsql-hackers
>>>>> "Andreas" == Andreas Karlsson <andreas@proxel.se> writes:

 > On 10/03/2018 05:57 PM, David Fetter wrote:
 >> Is there any meaningful distinction between "inlining," by which I
 >> mean converting to a subquery, and predicate pushdown, which
 >> would happen at least for a first cut, at the rewrite stage?

Yes.

 Andreas> Sorry, but I do not think I understand your question. The
 Andreas> ability to push down predicates is just one of the potential
 Andreas> benefits from inlining.

Consider the difference between (in the absence of CTE inlining):

-- inline subquery with no optimization barrier (qual may be pushed down)
select * from (select x from y) s where x=1;

-- inline subquery with optimization barrier (qual not pushed down)
select * from (select x from y offset 0) s where x=1;

-- CTE with materialization
with s as (select x from y) select * from s where x=1;

-- 
Andrew (irc:RhodiumToad)


pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Segfault when creating partition with a primary key and sql_droptrigger exists
Next
From: Pavel Stehule
Date:
Subject: Re: snprintf assert is broken by plpgsql #option dump