Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.03 KB

SRP0013.md

File metadata and controls

57 lines (42 loc) · 1.03 KB

SQL Server Rule: SRP0013

Assembly SqlServer.Rules.dll
Namespace SqlServer.Rules.Performance
Class AvoidOuterJoinsRule

Rule Information

Id SRP0013
Friendly Name Existence tested with JOIN
Category Performance
Ignorable true
Applicable Types Procedure
Scalar Function
Table Valued Function
View

Description

Consider replacing the OUTER JOIN with EXISTS.

Summary

Consider replacing the OUTER JOIN with EXISTS

Examples

SHOULD FLAG AS PROBLEM:

    SELECT a.*
    FROM a
    LEFT JOIN b ON a.id = b.id
    WHERE b.id IS NULL 

SHOULD NOT FLAG AS PROBLEM:

    SELECT a.*, b.*
    FROM a
    LEFT JOIN b ON a.id = b.id
    WHERE b.id IS NULL  
    SELECT a.*, b.*
    FROM a
    LEFT JOIN b ON a.id = b.id