SELECT DISTINCT Inside WHERE IN clause performance

Viewed 1660

I have a performance question about the following code...

SELECT*FROM GCL_Loans WHERE Loan_ID IN
(
    SELECT Loan_ID FROM GCL_Loan_Items
)

GCL_Loans has a list of loans with basic infomation CCL_Loan_Items has information about a specific item in a loan. There can be duplicate Loan_ID's in GCL_Loan_Items

Can anyone explain why this query would be faster or slower than the one above?

SELECT*FROM GCL_Loans WHERE Loan_ID IN
(
    SELECT DISTINCT Loan_ID FROM GCL_Loan_Items
)
3 Answers

The plan and performance of both is equal

Related