Re: Join questions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Join questions
Date: 2001-08-22 15:54:43
Message-ID: 10852.998495683@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> I have two related questions about joins.
> One is that if you don't group with parenthesis, what order are they
> done in?

Left to right. A JOIN B JOIN C == (A JOIN B) JOIN C.

> Will the optimizer be able to pick the better order of the two possible
> orders in the following example or do I need to try both and pick one?

The latter. See
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/explicit-joins.html

This behavior is not graven on stone tablets (at least not for inner
joins), but it was easy to do and is useful for cases where you *don't*
want the planner to try all possible join orders. So it'll probably
stay like that at least for a release or two, until we have enough field
experience to see whether people like it this way or not.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-08-22 15:57:38 Re: FTI is really really slow; what am I doing wrong?
Previous Message Bruno Wolff III 2001-08-22 15:44:59 Re: FTI is really really slow; what am I doing wrong?