Can somebody completely explain what is big difference in these two methods? Is there misunderstanding in database theory of programmers? Can somebody give a good article about the question or just say - what is a difference in these methods in PostgreSQL?
Asked
Active
Viewed 283 times
1
-
1Use EXPLAIN to see the difference. PostgreSQL is pretty smart in executing queries, it might come up with the same queryplan for both types of queries. – Frank Heikens Jun 28 '10 at 16:48
-
By `multiselect` you perhaps mean `subselect`? – leonbloy Jun 28 '10 at 17:43
-
1Perhaps related: http://stackoverflow.com/questions/2577174/sql-join-vs-subquery – leonbloy Jun 28 '10 at 17:44
2 Answers
2
Did you mean SELECT * FROM table1, table2 vs SELECT * FROM table1 JOIN table2 ON condition?
PostgreSQL optimizer makes this queries run with the same speed, but JOIN is more transparent and usable. Also, you can use LEFT/RIGHT JOIN.

Андрей Костенко
- 1,032
- 8
- 13
-
The first version is also subject to accidental cross joins and the second is much more maintainable. – HLGEM Jun 28 '10 at 17:26
1
In the PostgreSQL documentation there is a related topic. Explicit joins can give you more control over the execution order of statements using the join_collapse_limit GUC. Take a look at this page.
There are also all the other already mentioned advantages in readability and maintainability.

Diogo Biazus
- 622
- 3
- 12