2021-03-11, 07:22 AM (ISO 8601)
Re: SQL: RIGHT or LEFT JOIN more efficient
It is probably also worth noting that SQL engines don't always get their automatic query optimisation correct. Things are going to be far better now than when I actually knew some of the query execution/optimisation commands (20+ years ago) but for really complex queries and joins it can be that the nature of the data can make one way of executing significantly faster than another (e.g. do you hit the 100 record no-key join before the 100 million record primary key join?).
Knowing the ins and outs of optimising query execution used to be (and may well still be) a very lucrative profession and this is where knowing how the SQL engine in use handles left and right joins may make a difference, even though they are theoretically identical in the SQL language definition.