1

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dmytro
  • 2,200
  • 3
  • 20
  • 32

2 Answers2

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.

  • 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