ITPub博客

首页 > 数据库 > Oracle > optimizer_mode 之 all_rows

optimizer_mode 之 all_rows

原创 Oracle 作者:kennyblues 时间:2007-12-27 14:25:25 0 删除 编辑

看oracle performance tuning guide时看到一句:

ALL_ROWS --The optimizer uses a cost-based approach for all SQL statements in the session regardless of the presence of statistics and optimizes with a goal of best throughput (minimum resource use to complete the entire statement).

于是做了个测试:

1.将scott这个schema的所有statistics删除。

1.1用

sql>explian for select * from emp;

sql>@?/rdbms/admin/utlxpls

看到cost,rows等信息已消失,符合optimizer mode的choose规则:当对table做了analyze后,会采用CBO,此时,cost,rows,bytes等信息可见。若无统计信息,则采用rule,此时上述信息不可见。

2.sql>alter system set optimizer_mode=all_rows scope=spfile;

3.sql>startup force后在看select * from emp;的执行计划,已能看到cost等信息。

证明当optimizer_mode设成all_rows时,会自动采用CBO.

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3345/viewspace-995912/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 多列子查询
请登录后发表评论 登录
全部评论

注册时间:2008-03-07

  • 博文量
    73
  • 访问量
    482191