Re:What's the strangest code you've seen a senior developer ...
by zeroimpl on Sunday March 27, 2022 @11:40AM
(#30821085)
I'm surprised nobody else has mentioned this yet - a LEFT JOIN can be more efficient than an INNER JOIN precisely because the database doesn't need to enforce the filter during the query plan.
This comes up for me most often with views, when a query referencing the view doesn't end up using all the columns - when a LEFT JOIN is used, the database can potentially skip querying those tables entirely, but not with an INNER JOIN.
This comes up for me most often with views, when a query referencing the view doesn't end up using all the columns - when a LEFT JOIN is used, the database can potentially skip querying those tables entirely, but not with an INNER JOIN.