Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
515 views
in Technique[技术] by (71.8m points)

sql-server - 聚簇索引和非聚簇索引实际上是什么意思?(What do Clustered and Non clustered index actually mean?)

I have a limited exposure to DB and have only used DB as an application programmer.

(我对DB的接触有限,只使用DB作为应用程序程序员。)

I want to know about Clustered and Non clustered indexes .

(我想了解ClusteredNon clustered indexes 。)

I googled and what I found was :

(我搜索了一下,发现的是:)

A clustered index is a special type of index that reorders the way records in the table are physically stored.

(聚集索引是一种特殊的索引,它重新排序表中记录的物理存储方式。)

Therefore table can have only one clustered index.

(因此,表只能有一个聚集索引。)

The leaf nodes of a clustered index contain the data pages.

(聚集索引的叶节点包含数据页。)

A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.

(非聚集索引是一种特殊类型的索引,其中索引的逻辑顺序与磁盘上行的物理存储顺序不匹配。)

The leaf node of a nonclustered index does not consist of the data pages.

(非聚集索引的叶节点不包含数据页。)

Instead, the leaf nodes contain index rows.

(相反,叶节点包含索引行。)

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

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

.

(。)

Can someone explain this in plain English?

(有人可以用简单的英语解释吗?)

  ask by P.K translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

(如果需要重新排列数据,则写入具有聚集索引的表的速度可能会变慢。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...