I heard that using the IN clause can hurt performance because it does not use indexes properly. See the example below:
SELECT ID, Name, Address
FROM people
WHERE id IN (SELECT ParsedValue FROM UDF_ParseListToTable(@IDList))
Is it better to use the form below to get these results?
SELECT ID,Name,Address
FROM People as p
INNER JOIN UDF_ParseListToTable(@IDList) as ids
ON p.ID = ids.ParsedValue
Does it depend on which version of SQL Server you are using? If so, which ones are affected?
source
share