虽然索引可以显著提高查询性能,但是它会降低insert,update,delete与merge这些DML操作的性能。
索引总是增加插入,删除语句的开销,可能会增加更新语句的开销。因此,要避免过度索引,特别是要避免在更新频繁的字段上进行索引。
所以我们应该想办法标出没有被使用的索引。
select index_name,table_name,used,start_monitoring from V$object_usage where MONITORING='YES'
begin
for r in(select index_name from user_indexes)
loop
execute immediate 'ALTER INDEX ' || r.index_name ||
'MONITORING USAGE'
end loop
end