Thursday, March 28, 2013

Join tip – Inner Joins when using ON and WHERE Clause

 

When tuning queries, one the first basic strategies is to minimize the use of joins. Additionally outer joins incur more cost than inner joins as they require extra work to retrieve unmatched rows.

TIP : If only inner joins are used , the ON and WHERE Clause behave the same. Consider the following queries:

blog_where_on_clause_inner_joins

you can see that the execution plans generated for both queries are the same:

image

If the queries would have been written with outer join, they would have different query plans.

No comments:

Post a Comment