>>>>> "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)