索引的创建和使用

Posted WhiteSpace

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了索引的创建和使用相关的知识,希望对你有一定的参考价值。

使用T-sql语句创建索引

语法

if exists select * from sysindexes where name=‘索引名’)

go

drop index 表名.索引名

create [unique][clusterednonclustered] index 索引名 on 表名 (列名)[with fillfactor=x]

unique:唯一索引

clusterednonclustered:聚集索引或非聚集索引

fillfactor:充因子(系数):指定一个0-100之间的值,表示索引页填充的百分比

例如:

Create unique clustered index CL_xinxi on xinxiid

创建 唯一 聚集索引 cl_xinxi xinxi表上id

Create nonclustered index…………

查看索引的方式

使用系统的存储过程查看错音

EXEC sp_helpindex 表名

以上是关于索引的创建和使用的主要内容,如果未能解决你的问题,请参考以下文章

索引的创建和使用

使用索引别名和Rollover滚动创建索引

mysql索引创建和使用细节

数据库05 /索引原理/创建用户和授权/数据库备份/慢查询优化/正确使用索引

MySQL 高级--优化 —— 创建索引原则使用场景和索引失效的情况

Oracle创建索引SQL简单的例子,在表中的指定字段和如何使用索引呢?