数据库的几种索引

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ltd010/article/details/78762055

(1)按照索引列值的唯一性,索引可分为唯一索引和非唯一索引
①非唯一索引:B树索引
create index 索引名 on 表名(列名) tablespace 表空间名;
②唯一索引:建立主键或者唯一约束时会自动在对应的列上建立唯一索引
(2)索引列的个数:单列索引和复合索引
(3)按照索引列的物理组织方式
①B树索引
create index 索引名 on 表名(列名) tablespace 表空间名;
②位图索引
create bitmap index 索引名 on 表名(列名) tablespace 表空间名;
③反向键索引
create index 索引名 on 表名(列名) reverse tablespace 表空间名;
④函数索引
create index 索引名 on 表名(函数名(列名)) tablespace 表空间名;

删除索引
drop index 索引名
重建索引
alter index 索引名 rebuild

(1)按照索引列值的唯一性,索引可分为唯一索引和非唯一索引
①非唯一索引:B树索引
create index 索引名 on 表名(列名) tablespace 表空间名;
②唯一索引:建立主键或者唯一约束时会自动在对应的列上建立唯一索引
(2)索引列的个数:单列索引和复合索引
(3)按照索引列的物理组织方式
①B树索引
create index 索引名 on 表名(列名) tablespace 表空间名;
②位图索引
create bitmap index 索引名 on 表名(列名) tablespace 表空间名;
③反向键索引
create index 索引名 on 表名(列名) reverse tablespace 表空间名;
④函数索引
create index 索引名 on 表名(函数名(列名)) tablespace 表空间名;

删除索引
drop index 索引名
重建索引
alter index 索引名 rebuild

猜你喜欢

转载自blog.csdn.net/ltd010/article/details/78762055
今日推荐