Re: Which file does the SELECT? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Which file does the SELECT?
Date
Msg-id 12452.1286726358@sss.pgh.pa.us
Whole thread Raw
In response to Re: Which file does the SELECT?  (Vaibhav Kaushal <vaibhavkaushal123@gmail.com>)
Responses Re: Which file does the SELECT?
List pgsql-hackers
Vaibhav Kaushal <vaibhavkaushal123@gmail.com> writes:
> Can someone tell me what are 'Join Pairs with no Join clause' ? I am not
> able to figure that out!

Consider
select * from t1, t2, t3 where t1.a = t2.x and t1.b = t3.y;

In theory this query could be done by first joining t2 and t3, then
joining that to t1.  But the planner won't investigate the possibility
because the t2/t3 join would have to be a cartesian product join:
there's no WHERE clause relating them.

On the other hand, if we have
select * from t1, t2, t3 where t1.a = t2.x and t1.a = t3.y;

then the planner is able to infer the additional join clause t2.x =
t3.y, so it will consider that join sequence.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Vaibhav Kaushal
Date:
Subject: Re: Which file does the SELECT?
Next
From: Vaibhav Kaushal
Date:
Subject: Re: Which file does the SELECT?