| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Which file does the SELECT? |
| Date: | 2010-10-10 15:59:18 |
| Message-ID: | 12452.1286726358@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Vaibhav Kaushal <vaibhavkaushal123(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mladen Gogala | 2010-10-10 17:14:22 | Re: Slow count(*) again... |
| Previous Message | Tom Lane | 2010-10-10 15:38:59 | Re: Which file does the SELECT? |