Oracle 索引

创建索引
create index index_name on table_name(col_name);

唯一索引
create unique index index_name on table_name(col_name);

组合索引
create index index_name on table_name(col_name, col_name);
(* 最频繁访问的列放最前面)

反向键索引
create index index_name on table_name(col_name) reverse;
alert index index_name rebuild noreverse;
(* 不能将标准索引重建为反向键索引)

位图索引
create bitmap index index_name on table_name(col_name);
(* 适应于低基数列, 如某个列的值重复超过一百次)

索引组织表
create table table_name(
    col_name type primary key,
    col_name type
)
organization index;
(* primary key 是创建索引组织表所必需的)

基于函数的索引
create index index_name on table_name(upper(col_name));
(* 如果在 where 子句的算术表达式或函数中已经包含了某个列, 则不会使用该列上的索引, 所以要基于函数索引)

键压缩索引
create index index_name on table_name(col_name, col_name) compress 1
(* 前缀长度为键列的数目减1)

索引中的分区
create index index_name on table_name(col_name, col_name) [global/local]
partition by range(col2)
partition values less than (value1) tablespace tablespacename1,
partition values less than (value2) tablespace tablespacename2;
分区索引
本地索引(本地前缀索引   本地无前缀索引)
全局索引(全局前缀索引   全局无前缀索引)

获取索引信息
user_indexes            索引详细信息
user_ind_partitions     分区索引详细信息
user_ind_columns        列详细信息

你可能感兴趣的:(索引,唯一索引,组合索引,位图索引,反向键索引)