Why is SQL Server using index scan instead of index seek when WHERE clause contains parameterized values

前端 未结 4 1070
滥情空心
滥情空心 2020-12-18 05:02

We have found that SQL Server is using an index scan instead of an index seek if the where clause contains parametrized values instead of string literal.

<
4条回答
  •  天命终不由人
    2020-12-18 05:29

    I guess first query is using predicate and second query is using seek predicate.

    Seek Predicate is the operation that describes the b-tree portion of the Seek. Predicate is the operation that describes the additional filter using non-key columns. Based on the description, it is very clear that Seek Predicate is better than Predicate as it searches indexes whereas in Predicate, the search is on non-key columns – which implies that the search is on the data in page files itself.

    For more details please visit:- https://social.msdn.microsoft.com/Forums/sqlserver/en-US/36a176c8-005e-4a7d-afc2-68071f33987a/predicate-and-seek-predicate

提交回复
热议问题