Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery

From: Gavin Wahl <gavinwahl(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery
Date: 2013-10-17 02:45:12
Message-ID: CACPudh0h1tvujVnas=4D-b+JsWy2d8CVO761v5558c+P-50LWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> (3) is an instance of seeing "a = b and b = c" and deducing "a = c" from
> that. (4) does not follow that pattern, so it's outside the realm of what
the
> planner can deduce.

I see, that makes sense. I assumed there was something more complex going
on in
the background. What about converting (1) into (2)? I know the planner does
something kind of similar, in converting

SELECT * FROM (SELECT * FROM x WHERE a) WHERE b

into

SELECT * FROM (SELECT * FROM x WHERE a AND b)

I guess in this case it would have to know about unique indexes to prove
that
if the primary keys are equal, all the other columns are too. My intention
in
trying (3) was to take that burden of proof off the planner.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Ken Tanzer 2013-10-17 04:50:57 Re: BASH script for collecting analyze-related info
Previous Message Tom Lane 2013-10-16 08:28:44 Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery