Toad 中使用Oracle 优化器
在Toad中使用Oracle 优化器//前提:在优化之前,请对SQL中的表进行统计分析:
1 创建调试任务,调试SQL
在Editor中输入想要调试的SQL,可以是绑定了变量的服务,点击下拉框改sql语句,但是需要创建sql Profile给出这个sql的私有的执行计划,这个是一种情况,另外,优化器可能会给出加索引等优化方案,但是请注意,优化器给出的只是建议,所以在开发过程中,不是遇到建议就创建,因为在CBO中,Oracle会预先计算出每个表的数据量,再做分析,但是在实际生产过程中,表中的数据量都是测试环境无法模拟出来的。*/
------------------------------------------
- Consider accepting the recommended SQL profile.
execute (task_name =>
'PC-', replace => TRUE);
/*这里再给出优化器可能的另一种建议方式,就是索引的建立,下面给出的样例中,索引的创建对SQL性能的提升为100%:
Recommendation (estimated benefit: 100%)
----------------------------------------
- Consider running the Access Advisor to improve the physical schema design
or creating the recommended index.
create index $$_06C50001 on ('TABLE_NAME');
- Consider running the Access Advisor to improve the physical schema design
or creating the recommended index.
create index $$_06C50002 on ('OBJECT_NAME');
*/
-------------------------------------------------------------------------------
EXPLAIN PLANS SECTION
-------------------------------------------------------------------------------
/* Original With Adjusted Cost这一部分是当前的执行计划*/
1- Original With Adjusted Cost
------------------------------
Plan hash value: 1061520849
-------------------------
Oracle优化器使用方法 来自淘豆网m.daumloan.com转载请标明出处.