Hacker News new | ask | show | jobs
by mtone 1902 days ago
> This syntax is not as commonly used as the one above

This is going to need some sources. Is it true today? And why did they put parentheses in the ON condition?

Worth nothing that there were variants of the WHERE syntax to support left joins using vendor-specific operators such as A += B, A = B (+) -- those are clearly deprecated today. [1] [2]

I have a really hard time finding any source on the internet that recommends using the WHERE style joins. So by extension, I wouldn't expect to be used much anymore except for legacy projects. MS SQL Server docs docs mention ON syntax being "preferred" [3], and MySQL says "Generally, the ON clause serves for conditions that specify how to join tables, and the WHERE clause restricts which rows to include in the result set." [4]

The PostgreSQL docs seem misleading and outdated to me.

[1] https://docs.microsoft.com/en-us/archive/blogs/wardpond/depr...

[2] https://docs.oracle.com/cd/B19306_01/server.102/b14200/queri...

[3] https://docs.microsoft.com/en-us/sql/relational-databases/pe...

[4] https://dev.mysql.com/doc/refman/5.7/en/join.html

1 comments

I'm just quoting the manual here. I have no idea which style is really prevalent in the wild, now or X years ago.

My goal was only to cast doubt on the idea that WHERE clauses in general can't use indices.

Sure, let's debate what the nicest style is. But let's not claim that our preferred style somehow makes the DB go faster (without some kind of proof).

Indeed, they will perform the same or very close (the query plan might differ a bit due to the different orderings). Not sure where the author got that from. I'm complaining about the docs only.