Execution Plan in SSMS
Run Stored Procedure in SSMS with “Execution Plan” enabled. SSMS will recommend index to be created.
Improve Query Statement
Convert subqueries to main queries. Note: This may not always increase performance. Have to run the both queries side by side to test.
SELECT
*
FROM
tbTable01 T1
WHERE
NOT EXISTS(
SELECT TOP 1 1 FROM tbTable02 T2 WHERE T2.col02 = T1.col02
)
SELECT
*
FROM
tbTable01 T1
LEFT JOIN tbTable02 T2 ON T2.col02 = T1.col02
WHERE
T2.Col02 IS NULL
Comments