Do indexes work with “IN” clause

前端 未结 6 2124
生来不讨喜
生来不讨喜 2020-12-14 14:34

If I have a query like:

Select EmployeeId 
From Employee 
Where EmployeeTypeId IN (1,2,3)

and I have an index on the EmployeeTypeId

6条回答
  •  无人及你
    2020-12-14 15:14

    Usually it would, unless the IN clause covers too much of the table, and then it will do a table scan. Best way to find out in your specific case would be to run it in the query analyzer, and check out the execution plan.

提交回复
热议问题