简体   繁体   English

聚集索引与索引查找

[英]clustered index versus index seek

聚集索引和索引查找之间的主要区别是什么?

A clustered index physically places the indexes on disk in the sorted order so go through them faster. 聚集索引在物理上将索引按排序顺序放置在磁盘上,因此可以更快地处理它们。 It is best when used to iterate over the indexes in sorted order since the disk seeks will be continuous. 最好用于按排序顺序遍历索引,因为磁盘搜索将是连续的。

An index seek in simply a way to look for an index. 索引搜索只是一种寻找索引的方式。 This might be a b+tree , a hash , whatever method an index could be looked up. 这可能是一个b + tree ,一个hash ,可以查询索引的任何方法。

It's possible to have an index seek over a clustered index, they are not mutually exclusive. 可以在聚集索引上进行索引搜索,它们不是互斥的。

A non-clustered index is a kind of index where each leaf node of the index points to a row in the corresponding table. 非聚集索引是一种索引,其中索引的每个叶节点都指向对应表中的一行。

A clustered index is a kind of index where each leaf node of the index is the row in the corresponding table. 聚集索引是一种索引,其中索引的每个叶节点对应表中的行。 Obviously there can only be one clustered index for any given table (but there doesn't have to be one). 显然,任何给定的表只能有一个聚集索引(但不必是一个)。

An index seek is a method of looking for rows in a table where an index is consulted, individual pointers to individual rows are found, and only the pages containing the corresponding rows are loaded into memory. 索引查找是一种在表中查找要查询索引的行的方法,找到指向各个行的单独的指针,并且仅将包含相应行的页面加载到内存中。 An index seek is an efficient method of looking up rows in a query if the number of rows expected is small, and if they tend to be clustered together on a few pages instead of being spread out across all the pages in a table. 索引查找是一种有效的方法,可以在查询的行数很少的情况下查找查询中的行,并且如果它们趋向于聚集在几个页面上而不是散布在表的所有页面中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM