【OCP学习1z0-053记录55】STA&SQL plan baseline

绿色文字描述部分好深奥,不知道啥时间能遇到这种场景

253.You run the SQL Tuning Advisor (STA) to tune a SQL statement that is part of a fixed SQL plan
baseline. The STA generates a SQL profile for the SQL statement, which recommends that you accept the profile.Which statement is true when you accept the suggested SQL profile?
A. The tuned plan is not added to the SQL plan baseline.
B. The tuned plan is added to the fixed SQL plan baseline as a fixed plan.
C. The tuned plan is added to the fixed SQL plan baseline as a nonfixed plan.
D. The tuned plan is added to a new nonfixed SQL plan baseline as a nonfixed plan.
Answer: C
答案解析:
官方参考:http://docs.oracle.com/cd/E11882_01/server.112/e41573/optplanmgmt.htm#PFGRF95120
15.4 Using Fixed SQL Plan Baselines
如果SQL计划基线包含至少一个启用的计划,且该计划的固定属性设置为YES,则SQL计划基线是固定的。您可以使用固定的SQL计划基线来修复SQL语句的一组可能的计划(通常是一个计划),或者通过将“大纲”计划加载为固定计划来迁移现有的存储大纲。
如果固定SQL计划基线也包含非固定计划,那么优化器将优先选择固定计划而不是非固定计划。因此,优化器选择成本最低的固定计划,即使非固定计划的成本可能更低。如果没有一个固定的计划是可重复的,那么优化器将选择最佳的非固定计划。
优化器不会将新计划添加到固定的SQL计划基线。因为优化器不会自动添加新计划,所以在执行dbms_sp . evolve_sql_plan_baseline时,数据库不会演化出固定的SQL计划基线。但是,您可以通过从共享SQL区域或SQL调优集手动将新计划加载到固定的SQL计划基线中,从而改进它。
当您使用SQL Tuning Advisor使用固定的SQL计划基线对SQL语句进行调优时,SQL profile建议具有特殊的意义。当接受SQL概要文件时,数据库将调优后的计划作为非固定计划添加到固定SQL计划基线。然而,如上所述,当存在可重复的固定计划时,优化器不会使用经过调优的计划。因此,SQL调优的好处可能无法实现。要启用调优计划,请手动将调优计划更改为固定计划,方法是将其固定属性设置为YES。

猜你喜欢

转载自blog.csdn.net/viviliving/article/details/92565330
今日推荐