Skip site navigation (1) Skip section navigation (2)

INNER JOINS in sql-select.html

From: Stefan Weiss <spaceman-4b9f8-20030703(at)ausgehaucht(dot)sensenmann(dot)at>
To: pgsql-docs(at)postgresql(dot)org
Subject: INNER JOINS in sql-select.html
Date: 2003-10-27 22:09:37
Message-ID: 1503129.DJSjvup6Wb@weyoun.foo.at (view raw or flat)
Thread:
Lists: pgsql-docs
Hi.

>From <doc/html/sql-select.html>:
| A CROSS JOIN or INNER JOIN is a simple Cartesian product, the same
| as you get from listing the two items at the top level of FROM. CROSS
| JOIN is equivalent to INNER JOIN ON (TRUE), that is, no rows are
| removed by qualification. These join types are just a notational
| convenience, since they do nothing you couldn't do with plain FROM 
| and WHERE.

Is there really no difference between these two queries?

SELECT blarg
  FROM ta, tb, tc, [...]
 WHERE ta.foo = tb.bar
   AND tb.bar = tc.baz
   AND [...]

SELECT blarg
  FROM ta
  JOIN tb ON tb.bar = ta.foo
  JOIN tc ON tc.baz = tb.bar
  JOIN [...]

I thought that by using the second form, you would be able to do
'explicit' joins, effectivly telling the planner in which order to
join multiple tables (in case you have to join 10+ tables)?


cheers,
stefan

Responses

pgsql-docs by date

Next:From: Bruce MomjianDate: 2003-10-29 20:44:59
Subject: Re: 7.4 compatibility question
Previous:From: Tom LaneDate: 2003-10-27 21:28:24
Subject: Re: [GENERAL] sequences: cache_value, log_cnt, is_cycled columns

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group