非聚集索引中的行定位器

编程入门 行业动态 更新时间:2024-10-27 14:26:37
本文介绍了非聚集索引中的行定位器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在读有关Non Clustered Index的内容,该内容表示"Nonclustered索引仅包含索引列和行定位符中指向实际数据行的值,而不包含数据行本身.这意味着查询引擎必须采取其他步骤才能找到实际数据."

I was reading about Non Clustered Index which says that "Nonclustered index contain only the values from the indexed columns and row locators that point to the actual data rows, rather than contain the data rows themselves. This means that the query engine must take an additional step in order to locate the actual data."

查询-我对Row Locator不清楚.我假设它不是任何Primary key.后台发生了某些事情,与Row-Locator唯一标识行有关.

Query - I am not clear with Row Locator. I am assuming that it is not any Primary key. There is something happening in background which has to do with Row-Locator to uniquely identify the row.

推荐答案

如果表具有唯一的聚集索引,则行定位器"由聚集索引的列组成.

If the table has a unique clustered index, the "row locator" consists of the columns of the clustered index.

具有非唯一的聚集索引,行定位器"由聚集索引的列组成,再加上SQL Server添加的新字段以使引用唯一.新字段对用户不可见.它称为"uniqueifier",由四个字节组成.

With a non-unique clustered index, the "row locator" consists of the columns of the clustered index, plus a new field SQL Server adds to make the reference unique. The new field is invisible to users. It's called "uniqueifier" and consists of four bytes.

在没有聚集索引的表(即堆)中,行定位符"是RID或行标识符. RID指向物理位置.它由文件标识符(ID),页码和页面上的行号组成.

In a table without a clustered index (aka a heap), the "row locator" is a RID or row identifier. The RID points to a physical location. It consists of the file identifier (ID), page number, and number of the row on the page.

行定位器"的一个实际结果是,对于具有很多索引的表使用小的主键是有意义的:) 此MSDN页面上的完整详细信息.

One practical consequence of the "row locator" is that it makes sense to have a small primary key for a table with a lot of indexes :) Full details on this MSDN page.

更多推荐

非聚集索引中的行定位器

本文发布于:2023-10-15 02:23:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1492973.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:定位器   索引

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!