Professional Documents
Culture Documents
Oracle Database 19c SQL Tuning Using Plan Stability Methods SPM
Oracle Database 19c SQL Tuning Using Plan Stability Methods SPM
The following is intended to outline our general product direction. It is intended for information purposes
only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing decisions. The development,
release, timing, and pricing of any features or functionality described for Oracle’s products may change
and remains at the sole discretion of Oracle Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
• SPM is not the only method available to provide plan stability for
a SQL statement
• DBA_SQL_PLAN_BASELINES view uses SIGNATURE but not all
views have Signature column in them
GV$SQL has SIGNATURE while DBA_HIST_SQLTEXT does not have it
SQL_ID is universally used to uniquely identify a SQL in AWR reports, etc.
You may have to generate SIGNATURE value from SQL Text in some cases
Same plan can be used by multiple similar SQLs with bind variables if they
generate the same SIGNATURE
• Run the SQL and verify if the Baseline is being used or not:
• Enabled and Accepted flags must be set to YES before a baseline can be
considered by the optimizer
• You can have multiple baselines as Accepted for a SQL_ID
• Origin shows how the baseline was captured
• A bit tricky to join DBA_SQL_PLAN_BASELINES with DBA_HIST_SQLTEXT
• Need to generate SIGNATURE from SQL_TEXT
• Move quarantined plans from one database to another using DBMS_SQLQ package
• Add a SQL by SQL_ID or by SQL Text to quarantine a bad plan
• Add a PLAN_HASH_VALUE of a SQL_ID to quarantine
• Use DBMS_SQLQ.ALTER_QUARANTINE to adjust quarantine thresholds for an
execution
Soumendra Paik