1、索引提高查询速度,降低增删改速度
2、分类,逻辑分类,物理分类
logical:单列多列,唯一不唯一,基于函数的, 外部
physical: btree平衡树, bitmap 字典项索引(例如性别 where中有or时性能高),partition
3、内部组成结构
btree :index entry header(transaction slot) |{key column length|key column value}?(单列索引或多列索引)| rowid
bitmap : key |start rowid|end rowid|bitmap
4、重要参数:pctfree
5、要点:create index guideline:
separate tablespace,
uniform extent size(multiples of five blocks or min extent size of tablespace,
nologging for large index,
initrans should higher than the table
6、rebuild:删除记录时索引中只是做标记逻辑删除,仍占用空间,需要rebuild(挪到其他表空间重建),速度快于drop后create
7、coalesce:整理碎片,合并空间 (当索引中的块只有10-20%有剩余空间,其他完整的话,适用coalesce)
8、计算index碎片: analyze index idx_t_id validate structure 结果在index_stats表 (夜间批处理获取所有索引信息?)
9、监控索引使用情况 :alter index idx_t_id monitoring usage 结果在 v$object_usage
10、相关视图
dba_indexes
dba_ind_columns
index_stats
v$object_usage