1、创建数据,模拟场景
create table test_pln(c1 int PRIMARY key ,c2 int ,c3 varchar(100));
create index ix_test_pln_001 on test_pln(c2);
insert into test_pln select level,level,'aaaaa' from dual CONNECT by level<=300;
insert into test_pln select level+300,99999,'aaaaa' from dual CONNECT by level<=100000;
commit;
2、添加索引监控
alter index ix_test_pln_001 monitoring usage; --监控索引是否使用
备注:开启后,使用一段时间再去查看索引使用情况
3、执行SQL,使用索引
select * from test_pln where c2=1
4、查看索引使用情况
select * from SYS."V$OBJECT_USAGE" ;
5、取消索引监控
alter index ix_test_pln_001 nomonitoring usage;
文章
阅读量
获赞
