概述
最近比较忙,介绍一个之前做的简单点的实验,混合使用不同提示的hint,大家有空可以跟着做下。
基础环境准备
drop table t1;create table t1 as select * from dba_objects;insert into t1 select * from t1;insert into t1 select * from t1;commit;select count(*) from t1; =>349300create index idx_t1 on t1(object_id);update t1 set object_id=1 where rownum<320000;commit;
![d41090cee3e4ae73ec8476afea4c1230.png](https://img-blog.csdnimg.cn/img_convert/d41090cee3e4ae73ec8476afea4c1230.png)
/手动修改了OBJECT_ID的值,将表中绝大多数记录的OBJECT_ID设置为1
select count(*) from t1 where object_id=1; =>319999
//收集表的统计信息,注意此时也收集了相关对象--索引的统计信息
exec dbms_stats.gather_table_stats(ownname=>'SCOTT',tabname=>'T1',estimate_percent=>100,method_opt=>'for columns size auto object_i