什么是Sql Server中的书签查找? [英] What is a Bookmark Lookup in Sql Server?

查看:104
本文介绍了什么是Sql Server中的书签查找?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试优化查找历史数据的查询。我正在使用查询分析器来查找执行计划,并发现我的大部分查询成本都在称为书签查找。我以前从未在执行计划中看到过这个节点,也不知道它意味着什么。

I'm in the process of trying to optimize a query that looks up historical data. I'm using the query analyzer to lookup the Execution Plan and have found that the majority of my query cost is on something called a "Bookmark Lookup". I've never seen this node in an execution plan before and don't know what it means.

在查询中这是好事还是坏事?

Is this a good thing or a bad thing in a query?

推荐答案

书签查找是根据非聚集索引中的条目查找SQL表中的实际数据的过程。

A bookmark lookup is the process of finding the actual data in the SQL table, based on an entry found in a non-clustered index.

搜索时非聚集索引中的值,并且您的查询需要的字段多于索引叶节点的一部分(所有索引字段以及任何可能的INCLUDE列),然后SQL Server需要检索实际的数据页 - 这就是所谓的书签查找。

When you search for a value in a non-clustered index, and your query needs more fields than are part of the index leaf node (all the index fields, plus any possible INCLUDE columns), then SQL Server needs to go retrieve the actual data page(s) - that's what's called a bookmark lookup.

在某些情况下,这是唯一的方法 - 只有当你的查询只需要一个字段时(不是一大堆)对于'em),在非聚集索引中包含该字段可能是个好主意。在这种情况下,非聚集索引的叶级节点将包含满足查询所需的所有字段(覆盖索引),因此不再需要书签查找。

In some cases, that's really the only way to go - only if your query would require just one more field (not a whole bunch of 'em), it might be a good idea to INCLUDE that field in the non-clustered index. In that case, the leaf-level node of the non-clustered index would contain all fields needed to satisfy your query (a "covering" index), and thus a bookmark lookup wouldn't be necessary anymore.

Marc

这篇关于什么是Sql Server中的书签查找?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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