Monday, March 26, 2012

Right/left outer joins & performance

Other than being much less readable, is there a downside to combining left and right outer joins in the same SELECT? I'm reviewing some generally poor code done by a contractor and it's peppered with queries with both left and right joins. I've always thought it was just a semantic difference, but I was just wondering if, other than readability, there were any performance issues.

Thanks,
PeteLeft and right outer joins do different things. Whether the Sql is running the correct logic for the situation is what is most important. It's certainly possible that the query performance could be enhanced, particularly once multiple joins are involved but that is secondary do whether the queries are returning what is required.

I would try to understand what each query is trying to do and based on that think about alternatives that may simpify it and/or improve performance.sql

No comments:

Post a Comment