您的位置:首页 > 数据库 > Oracle

oracle全表扫描的优化

2010-01-06 17:04 441 查看
全表扫描的优化
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,因为一次读的块多了,代价减少
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: