Re: Join questions - Mailing list pgsql-general

From Tom Lane
Subject Re: Join questions
Date
Msg-id 10852.998495683@sss.pgh.pa.us
Whole thread Raw
In response to Join questions  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
Bruno Wolff III <bruno@wolff.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

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Join questions
Next
From: will trillich
Date:
Subject: Re: Printable report generation