索引失效查询就不用了呗,不过不失效也未必用举个例子,刚开始走索引,失效后就不走了呗,--创建索引
create index emp_deptno on emp(deptno);
--查看创建的索引
select index_name,table_name,status from user_indexes where table_name='EMP';
--解释
explain plan for select dept.dname,emp.* from emp,dept where emp.deptno=dept.deptno;
--查看执行计划
select * from table(dbms_xplan.display);
--临时禁用索引
alter index emp_deptno unusable;
--查看创建的索引(已禁用)
select index_name,table_name,status from user_indexes where table_name='EMP';
--解释
explain plan for select dept.dname,emp.* from emp,dept where emp.deptno=dept.deptno;;
--查看执行计划
select * from table(dbms_xplan.display);
--恢复
alter index emp_deptno rebuild online;