Possible Duplicates:
Difference between clustered and nonclustered index
What do Clustered and Non clustered index actually mean?可能的重复:聚簇索引和非聚簇索引之间的区别聚簇索引和非聚簇索引实际上是什么意思?
Hi experts,
嗨专家,
What does the word "clustered" mean in "clustered index"? I am doubting that it has something to do with the disk sector usage. Because I vaguely remember that Windows organizes disk space into clusters, which is composed of one or more 512-byte sectors. Do these 2 concepts have any connections?
“聚集”一词在“聚集索引”中的含义是什么?我怀疑它与磁盘扇区的使用有关。因为我依稀记得Windows将磁盘空间组织成集群,集群由一个或多个512字节扇区组成。这两个概念有任何联系吗?
Thanks.
谢谢。
2 个解决方案
#1
10
A clustered index represents the physical order of the records on disk. Nonclustered indices are merely "pointers" to the physical records in the table; they are in order of their key(s) and contain the data of their keys and any included columns.
聚簇索引表示磁盘上记录的物理顺序。非聚集索引仅仅是表中物理记录的“指针”;它们按键的顺序排列,并包含其键和任何包含列的数据。
Consider the index of a book vs. its page numbers: the index contains an alphabetized list of topics, and maybe it contains a summary of the topic, but the topics themselves are on the referenced pages. Page numbers, then, would be the clustered index.
考虑书籍的索引与其页码:索引包含按字母顺序排列的主题列表,可能包含主题摘要,但主题本身位于引用的页面上。那么,页码就是聚集索引。
It follows that you should consider choosing an immutable, monotonically increasing primary key for the clustered index so that things don't need to be rearranged when inserting and updating.
因此,您应该考虑为聚簇索引选择不可变的,单调递增的主键,以便在插入和更新时不需要重新排列。
#2
-1
Clustered means that records with similar keys are stored (for the most part) next to each other on disk. So if you have a key with just 1 integer column, the record with a value of "1" will be located next to the record with value "2". If you have multiple records, for instance questionid and answerid, then all the answers belonging to a particular question will be grouped together on disk, making it faster to access them.
群集意味着具有相似键的记录(在大多数情况下)存储在磁盘上彼此相邻。因此,如果您的密钥只有1个整数列,则值为“1”的记录将位于值为“2”的记录旁边。如果您有多个记录,例如questionid和answerid,则属于特定问题的所有答案将在磁盘上组合在一起,从而加快访问它们的速度。
#1
10
A clustered index represents the physical order of the records on disk. Nonclustered indices are merely "pointers" to the physical records in the table; they are in order of their key(s) and contain the data of their keys and any included columns.
聚簇索引表示磁盘上记录的物理顺序。非聚集索引仅仅是表中物理记录的“指针”;它们按键的顺序排列,并包含其键和任何包含列的数据。
Consider the index of a book vs. its page numbers: the index contains an alphabetized list of topics, and maybe it contains a summary of the topic, but the topics themselves are on the referenced pages. Page numbers, then, would be the clustered index.
考虑书籍的索引与其页码:索引包含按字母顺序排列的主题列表,可能包含主题摘要,但主题本身位于引用的页面上。那么,页码就是聚集索引。
It follows that you should consider choosing an immutable, monotonically increasing primary key for the clustered index so that things don't need to be rearranged when inserting and updating.
因此,您应该考虑为聚簇索引选择不可变的,单调递增的主键,以便在插入和更新时不需要重新排列。
#2
-1
Clustered means that records with similar keys are stored (for the most part) next to each other on disk. So if you have a key with just 1 integer column, the record with a value of "1" will be located next to the record with value "2". If you have multiple records, for instance questionid and answerid, then all the answers belonging to a particular question will be grouped together on disk, making it faster to access them.
群集意味着具有相似键的记录(在大多数情况下)存储在磁盘上彼此相邻。因此,如果您的密钥只有1个整数列,则值为“1”的记录将位于值为“2”的记录旁边。如果您有多个记录,例如questionid和answerid,则属于特定问题的所有答案将在磁盘上组合在一起,从而加快访问它们的速度。