Re: difference between join syntax

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Natan <nvivo(at)mandic(dot)com(dot)br>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: difference between join syntax
Date: 2004-08-30 00:54:20
Message-ID: 18155.1093827260@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Natan <nvivo(at)mandic(dot)com(dot)br> writes:
> Can anyone tell me if there is any difference between these two commands:
> select * from table1, table2 where table1.id = table2.id
> and
> select * from table1 inner join table 2 on table1.id = table2.id

Nope.

> I checked the query plan for both and they appear exactly the same. But
> in this case, i am working with only two tables in a very simple
> join.... What i would like to know is: in a production environment with
> lots of joins and where clauses, does it make any difference to write in
> one form or in the other, or the joins are like shortcuts to the first form?

With more than two tables, it *can* make a difference. If using 7.4,
see
http://www.postgresql.org/docs/7.4/static/explicit-joins.html
Earlier versions were a bit different --- make the obvious change in
the URL to see the corresponding docs for your version.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Rajan Bhide 2004-08-30 09:20:49 Release 7.4.5
Previous Message Natan 2004-08-30 00:03:10 difference between join syntax