SqlServer的三个索引简单说明及其使用

简介:

1、unique:唯一索引,该字段的每个记录的值都不能重复。

2、clustered:聚集索引,可以包含多个列,比非聚集索引要快,但是每个表只能有一个。

3、nonclustered:非聚集索引,单列使用,可以提高检索性能,但是会增加硬盘存储的数据,也就是说空间换时间

使用方式:

CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name   
    ON <TABLE_NAME> ( column_name [ ASC | DESC ] [ ,...n ] )   
    [ WITH <backward_compatible_index_option> [ ,...n ] ]  
    [ ON { filegroup_name | "default" } ]  

简单的例子:

create clustered index opde_biid_cd
on opde (biid)

使用建议:

猜你喜欢

转载自www.cnblogs.com/chenshiheng/p/8960920.html