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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-docs by date

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