11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 4 ■ PERFORMANCE MANAGEMENT 207SQL Plan Management (SPM)It’s not uncommon at all for DBAs to confront situations where a well-functioning systemencounters performance problems because of a regression in the execution plans of SQL statements.Execution plans for SQL statements could change for a number of reasons, includingthe upgrade of the <strong>Oracle</strong> database or the operating system software, changes in optimizerversions, optimizer statistics or optimizer parameters, data changes, schema definition andmetadata changes, deployment of new application modules, adding and dropping indexes,and so on. In earlier versions, <strong>Oracle</strong> provided features such as stored outlines and SQL profilesto enable the stability of execution plans over time. However, all these required you, the DBA,to decide to use and implement the plan stability features.<strong>Oracle</strong> <strong>Database</strong> <strong>11</strong>g introduces a new plan stabilization feature called SQL Plan Managementthat lets the database control the evolution of SQL execution plans through SQL plan baselines. Thegoal of SPM is to preserve the performance of your SQL code in the face of changes such asdatabase upgrades, system and data changes, and application upgrades and bug fixes. You cancurrently use SQL profiles through <strong>Oracle</strong>’s automatic SQL tuning feature to produce welltunedexecution plans, but that is a purely reactive mechanism, which doesn’t help you whenthere are drastic changes in your system. <strong>Oracle</strong> has designed SPM as a preventative mechanismthat aims to preserve the performance of SQL statements in the face of numerous types ofchanges that we listed earlier. Whereas a SQL profile contains statistics that will improve theexecution plan for a SQL statement, a SQL plan baseline contains hints for the optimizer togenerate a better execution plan for a SQL statement.Once you enable this new plan stabilization feature, new execution plans generated bychanges in factors such as optimizer statistics, for example, are accepted only if they don’t leadto a deterioration in performance. The cost-based optimizer manages the SQL plan baselinesand uses only known and verified plans. After verification, the optimizer uses only comparableplans or plans that yield better performance than the current execution plans. SPM builds SQLplan baselines of known good execution plans. SQL Plan Management aims to replace the planstability feature in earlier releases of the <strong>Oracle</strong> database. The older stored outlines feature isdeprecated in this release, and <strong>Oracle</strong> recommends that you migrate your stored outlines toSQL plan baselines.The database stores an execution plan as a SQL baseline, thus maintaining the plan for aset of SQL statements. Provided the database has the necessary optimizer statistics, the optimizerfirst evolves a best-cost plan and then tries to match it with a plan in the SQL plan baseline.If the optimizer finds a match, it uses this plan. Otherwise, the optimizer will evaluate all theaccepted plans in the SQL baseline and choose the lowest cost plan for executing the statement.■Note The database tracks SQL plan history only for statements that execute multiple times. Ad hocqueries aren’t, by definition, eligible for tracking.SPM involves three distinct steps or stages—capturing, selecting, and evolving SQL planbaselines. The following sections summarize the three phases.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!