哪个更好:书签/键查找或索引扫描 [英] Which is better: Bookmark/Key Lookup or Index Scan

查看:72
本文介绍了哪个更好:书签/键查找或索引扫描的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道索引 seek 优于索引 scan ,但是在SQL Server解释计划中更可取:索引查找或键查找(SQL Server中的书签) 2000)?

I know that an index seek is better than an index scan, but which is preferable in SQL Server explain plans: Index seek or Key Lookup (Bookmark in SQL Server 2000)?

请告诉我,他们没有再次更改SQL Server 2008的名称...

Please tell me they didn't change the name again for SQL Server 2008...

推荐答案

每次都进行索引查找.

查找非常昂贵,因此它涵盖了索引,尤其是添加了INCLUDE子句以使索引更好.

Lookups are expensive, so this is covering indexes and especially the INCLUDE clause was added to make them better.

说,例如,如果您只希望一行,那么在查找后进行查找可能比尝试覆盖查询要好.在某些情况下,我们依靠它来避免使用另一个索引.

Saying that if you expect exactly one row, for example, a seek followed a lookup can be better than trying to cover a query. We rely on this to avoid yet another index in certain situations.

简单讨论文章:使用覆盖索引来提高查询性能

编辑,2012年8月

每行 会发生查找,这就是它们扩展性很差的原因.最终,优化器将选择聚簇索引扫描,而不是搜索+查找,因为它比许多查找更有效.

Lookups happen per row which is why they scale badly. Eventually, the optimiser will choose a clustered index scan instead of a seek+lookup because it's more efficient than many lookups.

这篇关于哪个更好:书签/键查找或索引扫描的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆