聚集索引和非聚集索引实际上是什么意思?

编程入门 行业动态 更新时间:2024-10-28 02:28:31
本文介绍了聚集索引和非聚集索引实际上是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我对 DB 的接触有限,并且仅将 DB 用作应用程序程序员.我想了解Clustered 和Non clustered index.我用谷歌搜索,我发现的是:

I have a limited exposure to DB and have only used DB as an application programmer. I want to know about Clustered and Non clustered indexes. I googled and what I found was :

聚集索引是一种特殊类型的索引,它重新排序方式表中的记录是物理上的存储.因此表只能有一个聚集索引.叶节点聚集索引包含数据页.非聚集索引是特殊类型的索引,其中索引的逻辑顺序不匹配物理存储顺序磁盘上的行.a的叶子节点非聚集索引不包括数据页.取而代之的是叶节点包含索引行.

我在 SO 中发现的是 什么聚集索引和非聚集索引之间的区别是什么?.

What I found in SO was What are the differences between a clustered and a non-clustered index?.

有人可以用简单的英语解释一下吗?

Can someone explain this in plain English?

推荐答案

使用聚集索引,行以与索引相同的顺序物理存储在磁盘上.因此,聚集索引只能存在一个.

With a clustered index the rows are stored physically on the disk in the same order as the index. Therefore, there can be only one clustered index.

对于非聚集索引,有第二个列表指向物理行.您可以有许多非聚集索引,尽管每个新索引都会增加写入新记录所需的时间.

With a non clustered index there is a second list that has pointers to the physical rows. You can have many non clustered indices, although each new index will increase the time it takes to write new records.

如果您想取回所有列,从聚集索引中读取通常会更快.您不必先访问索引,然后再访问表.

It is generally faster to read from a clustered index if you want to get back all the columns. You do not have to go first to the index and then to the table.

如果需要重新排列数据,写入带有聚集索引的表可能会更慢.

Writing to a table with a clustered index can be slower, if there is a need to rearrange the data.

更多推荐

聚集索引和非聚集索引实际上是什么意思?

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

发布评论

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

>www.elefans.com

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