IN/OR performance difference | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

IN/OR performance difference

Is there any performance difference between using an "in" statement or multiple "or" statements? EX: USE Northwind select * from Invoices
where ProductID in (14,51,22,57) select * from Invoices
where ProductID = 14 or ProductID = 51 or ProductID = 22 or ProductID = 57
No. When a list of values are supplied, SQL Server internally replaces the IN with multiple ORs.
With a subquery, its a different story, Roji. P. Thomas
SQL Server MVP

sometimes you will also see that the in list is converted to a rowset which can be joined to other tables