INNER JOINS in sql-select.html

Поиск
Список
Период
Сортировка
От Stefan Weiss
Тема INNER JOINS in sql-select.html
Дата
Msg-id 1503129.DJSjvup6Wb@weyoun.foo.at
обсуждение исходный текст
Ответы Re: INNER JOINS in sql-select.html  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

В списке pgsql-docs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] 7.4 compatibility question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: INNER JOINS in sql-select.html