全表扫描的优化
analyze table t1 estimate statistics;
收集统计信息
select * from t1;
执行计划为全表扫描,假设代价为68
select /*+ full(t1) parallel(t1,4) */ * from t1;
使用并行查询的强制,代价为17
alter table t1 pctfree 0;
alter table t1 move tablespace users;
select * from t1;
执行计划为全表扫描,代价为63,比第一次要小.因为扫描的块少了.
alter system set db_file_multiblock_read_count=8;
执行计划为全表扫描,代价为98,因为一次读的块少了(默认是16),代价增加
alter system set db_file_multiblock_read_count=32;
执行计划为全表扫描,代价为40,因为一次读的块多了,代价减少