为什么每个表只有一个聚簇索引 [英] why only one clustered index per table

查看:994
本文介绍了为什么每个表只有一个聚簇索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么每个表只有一个聚簇索引plz解释原因

why only one clustered index per table plz explain with reason

推荐答案

引用 Microsoft [ ^ ]:

聚簇索引排序和存储表中的数据行基于索引键值。因此,每个表上只能创建一个聚簇索引,因为数据行本身只能按一个顺序排序。



在同一个表上创建不同的聚簇索引,在创建第二个索引之前更改现有聚簇索引上的Create as Clustered属性设置。



有关更多信息,请参见如何:更改索引属性(可视化数据库工具) [ ^ ]和如何:创建聚簇索引(Visual Database Tools) [ ^ ]。

A clustered index sorts and stores the data rows in the table based on the index key values. Therefore only one clustered index can be created on each table because the data rows themselves can only be sorted in one order.

To create a different clustered index on the same table, change the Create as Clustered property setting on the existing clustered index before creating the second index.

For more information, see How to: Change Index Properties (Visual Database Tools)[^] and How to: Create Clustered Indexes (Visual Database Tools)[^].


大家好,



群集索引按物理排序lly,叶节点上的数据只按一个特定的顺序排序,因为只能创建一个集群索引并使其索引表与叶节点(数据页面)相关联。

集群索引也可以为两列(复合集群索引)创建,但每个表只有一个聚簇索引。



集群索引示例:电话簿按字母顺序排列方式,例如有两个叫做raju的名字,然后它会先用名字排序,然后用姓氏排序





非集群index:数据在叶子节点(数据页面)中,并且不按行指针指向数据所在的叶子节点的顺序。

表格可以有多个非节点群集索引。



非群集索引的示例:首页中书籍的索引,其中页码指向书中的特定主题,但未订购以一种特殊的方式。一个标签le可以有多个非集群索引。



谢谢..
Hi All,

Cluster index are sorted physically ,the data at the leaf node are sorted on only one particular order since there will be only one cluster index can be created and having its index table associate with leaf node(data page).
Cluster index can also be created for two columns(composite cluster indexing) also,but only one clustered index per table.

Example for cluster index :Telephone book is ordered in the alphabetic way, for example there are two names called raju then it will sort first with first name and then with last name


Non-Clustered index:The data is in leaf node(data page),and are not in order where the row pointer are pointing to the leaf node where the data is located.
the table can have more then one non cluster indexing.

Example for non cluster indexing :Index on books in front page,where the page number points to that particular topic in the book,But it is not ordered in the one particular way.A table can have more then one non cluster index.

Thanks..


聚集索引:聚簇索引定义数据在磁盘上物理排序的方式。并且只能有一种方法可以在物理上订购数据。因此每个表只能有一个聚簇索引。



为什么要关心聚簇索引?如果我们将聚簇索引放在表上,那么数据的检索要快得多,因为sql server不必读取整个数据 - 取决于查询。但是数据检索要快得多。



注意:虽然你可以在一个表上创建多个非聚集索引。
Clustered Index: Clustered index defines the way in which data is ordered physically on the disk. And there can only be one way in which you can order the data physically. Hence there can only be one clustered index per table.

Why care about clustered index? If we put clustered index on the table then the data is retrieved much more faster because sql server doesnot have to read the whole data -- Depends on query. But data retrieval is much more faster.

NOTE: Although you can create more than one Non-Clustered index on a single table.


这篇关于为什么每个表只有一个聚簇索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆