ORACLE Index

默认Index:忽略null
bitmap Index:不忽略null
推荐:只有当大量次数的查询只涉及总表的2% - 4%的数据量
当列的值更新后,Index会将叶节点删除,重建。
Create index condition
1. the search records shoud be over 10%-15% of the total records.
2. monitor the actions operate to the table, if most is DML, should reduce the number of index. 

Create index
create index <index_name> on <table name> (<column name>) tablespace <tablespace name>;

Example: create index CAR_TLO_PRO_TLG_ID on CARROT_TLOG_PROCESS_LOG(tlog_id) TABLESPACE INDEX_1 nologging PARALLEL 4;

分析Index:
分析:exec dbms_stats.gather_index_stats('hr','id_in');
查看分析结果:select * from user_indexes where index_name=‘ID_IN';
状态:valid / NA / unusable
说明:
valid:        当前索引有效
NA:           分区索引有效
unusable: 索引无效
针对unusable:alter index 名字 rebuild;
使用oracle的监控特性alter index <index_name> monitoring usage; --对index_name开启监控
alter index <index_name> nomonitoring usage; --对index_name取消监控
select * from v$object_usage; --查询索引是否被使用
需要重建
1. 修改存储选项;
2. 更换表空间;

Comments

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error