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

From Tom Lane
Subject Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery
Date
Msg-id 7176.1381912124@sss.pgh.pa.us
Whole thread Raw
In response to Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery  (Gavin Wahl <gavinwahl@gmail.com>)
Responses Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery  (Gavin Wahl <gavinwahl@gmail.com>)
List pgsql-performance
Gavin Wahl <gavinwahl@gmail.com> writes:
> It'd be nice if the planner could optimize the query (1) by turning it
> into (2). I understand that it might not be able to, but if it can pull
> the condition up in (3), why can't it in (4)?

(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.

In principle we could take "a = b and (b = c or b = d)" and deduce
"a = c or a = d" from that, but it'd be a lot more complication for a
lot less benefit than what we get from the existing logic.

            regards, tom lane


pgsql-performance by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: BASH script for collecting analyze-related info
Next
From: Gavin Wahl
Date:
Subject: Re: Planner Conceptual Error when Joining a Subquery -- Outer Query Condition not Pulled Into Subquery