What are examples of SQL Server Query features/clauses that should be avoided?
Recently I got to know that the NOT IN clause degrades performance badly.
Do you have more examples?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The reason to avoid
NOT INisn’t really performance, it’s that it has really surprising behaviour when the set contains a null. For example:This won’t return any rows, because the
whereis interpreted like:First
1 <> nullevaluates to unknown. Then1 <> 2 and unknownevaluates to unknown. So you won’t receive any rows.