SQL Plan Management. on 12c Kerry Osborne OakTable World, 2013

Similar documents
Adaptive Optimization. Presented by: Kerry Osborne Red Gate Webinar, Nov. 2013

Top 7 Plan Stability Pitfalls & How to Avoid Them. Neil Chandler Chandler Systems Ltd UK

Exadata. Presented by: Kerry Osborne. February 23, 2012

SQL Plan Management with Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R J A N U A R Y

SQL Gone Wild: Taming Bad SQL the Easy Way (or the Hard Way) Sergey Koltakov Product Manager, Database Manageability

Who Changed My Plan? Prasanth Kothuri, CERN

EZY Intellect Pte. Ltd., #1 Changi North Street 1, Singapore

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Advanced Oracle SQL Tuning v3.0 by Tanel Poder

Oracle Database 11g: SQL Tuning Workshop

Oracle Database 12c: Performance Management and Tuning

Kerry Osborne Enkitec Chris Wones - dunnhumby E My PX Goes to 11

In the Oracle Database 12c: Performance Management and

Query Optimizer, Who Influences & How it works ++ optimization techniques

SQL Transla+on Framework

Oralogic Education Systems

Neil Chandler, Chandler Systems Oracle & SQL Server DBA

Learning Objectives : This chapter provides an introduction to performance tuning scenarios and its tools.

Oracle Database 12c Performance Management and Tuning

Oracle 1Z Oracle Database 11g Release 2- SQL Tuning. Download Full Version :

Oracle 1Z0-054 Exam Questions and Answers (PDF) Oracle 1Z0-054 Exam Questions 1Z0-054 BrainDumps

MILOŠ RADIVOJEVIĆ, PRINCIPAL DATABASE CONSULTANT, BWIN GVC, VIENNA, AUSTRIA

Top 10 Features in Oracle 12C for Developers and DBA s Gary Bhandarkar Merck & Co., Inc., Rahway, NJ USA

Oracle Database 11g: Performance Tuning DBA Release 2

Oracle Database 11g : Performance Tuning DBA Release2

Demystifying SQL Tuning: Tips and Techniques for SQL Experts

Real World Exadata. Presented by: Kerry Osborne. March 7, 2012

Oracle Database 11g: Performance Tuning DBA Release 2

Exadata Implementation Strategy

Introduction SPM Overview Our Objectives Our Results Other Considerations Summary

Join Methods. Franck Pachot CERN

KillTest *KIJGT 3WCNKV[ $GVVGT 5GTXKEG Q&A NZZV ]]] QORRZKYZ IUS =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX

Performance Problems

Oracle Database 12c: SQL Tuning for Developers

<Insert Picture Here> Oracle Database 11g: Neue Features im Oracle Optimizer

Tuning SQL without the Tuning Pack. John Larkin JP Morgan Chase

Oracle EXAM - 1Z Oracle Database 11g: Performance Tuning. Buy Full Product.

Bind Peeking The Endless Tuning Nightmare

Oracle 9i Application Development and Tuning

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

PERFORMANCE TUNING TRAINING IN BANGALORE

Oracle SQL Tuning for Developers Workshop Student Guide - Volume I

Tuning slow queries after an upgrade

Copyright 2018, Oracle and/or its affiliates. All rights reserved.

Enkitec Exadata Implementation & POC Success Stories

Does Exadata Need Performance Tuning? Jože Senegačnik, Oracle ACE Director, Member of OakTable DbProf d.o.o. Ljubljana, Slovenia

<Insert Picture Here> DBA Best Practices: A Primer on Managing Oracle Databases

HOW TO PERFORM AN EBS DATABASE HEALTH CHECK BEFORE GOING TO THE CLOUD DIMAS CHBANE ACCENTURE ENKITEC GROUP

This presentation is for informational purposes only and may not be incorporated into a contract or agreement.

Top 5 Issues that Cannot be Resolved by DBAs (other than missed bind variables)

DESIGNING FOR PERFORMANCE SERIES. Smokin Fast Queries Query Optimization

New Optimizer Features in Oracle 12c

OpenWorld 2018 SQL Tuning Tips for Cloud Administrators

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

<Insert Picture Here> Inside the Oracle Database 11g Optimizer Removing the black magic

SQLSaturday Sioux Falls, SD Hosted by (605) SQL

Manage Change With Confidence: Upgrading to Oracle Database 11g with Oracle Real Application Testing

Data Warehouse Tuning. Without SQL Modification

New Features in SQL That Will Change the Way You Tune

Oracle Database 11g: SQL Tuning Workshop. Student Guide

Oracle Database 10g The Self-Managing Database

Triangle SQL Server User Group Adaptive Query Processing with Azure SQL DB and SQL Server 2017

Independent consultant. Oracle ACE Director. Member of OakTable Network. Available for consulting In-house workshops. Performance Troubleshooting

How Can I Tune it if I Can t Change the Code

Slide 2 of 79 12/03/2011

Tuna Helper Proven Process for SQL Tuning. Dean Richards Senior DBA, Confio Software

Exadata Implementation Strategy

Session id: The Self-Managing Database: Guided Application and SQL Tuning

Configuration changes such as conversion from a single instance to RAC, ASM, etc.

Oracle Performance Tuning. Overview of performance tuning strategies

Independent consultant. Oracle ACE Director. Member of OakTable Network. Available for consulting In-house workshops. Performance Troubleshooting

Vijay Mahawar

IT-Tage Dezember 2016 Frankfurt am Main Maritim Hotel

Full Throttle: SQL Tuning & Ressource Consumption Appr.

Exadata X3 in action: Measuring Smart Scan efficiency with AWR. Franck Pachot Senior Consultant

Optimize Your Databases Using Foglight for Oracle s Performance Investigator

Monitoring & Tuning Azure SQL Database

Database Performance Analysis Techniques Using Metric Extensions and SPA

ORACLE TRAINING CURRICULUM. Relational Databases and Relational Database Management Systems

Optimizer with Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R J U N E

Introduction to Statistics in SQL Server. Andy Warren

Optimizer Challenges in a Multi-Tenant World

Oracle Exadata Implementation Strategy HHow to Implement Exadata In-house

Oracle 1Z0-417 Exam Questions and Answers (PDF) Oracle 1Z0-417 Exam Questions 1Z0-417 BrainDumps

Identifying and Fixing Parameter Sniffing

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

11g Tech Briefing: Performance. Part 1 of 2

SQL Tuning for Expert DBAs

<Insert Picture Here> Managing Oracle Exadata Database Machine with Oracle Enterprise Manager 11g

<Insert Picture Here> Looking at Performance - What s new in MySQL Workbench 6.2

Natural Born Killers, performance issues to avoid

Presentation Abstract

Manually Create Sql Profile Oracle 10g

Essential (free) Tools for DBA!

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Tosska SQL Tuning Expert Pro for Oracle

Estimating Cardinality: Use of Jonathan Lewis CBO methodology

Oracle DB-Tuning Essentials

Using Oracle STATSPACK to assist with Application Performance Tuning

Dan Hotka Author/Instructor Oracle Ace Director.

Transcription:

SQL Plan Management on 12c Kerry Osborne OakTable World, 2013

whoami Never Worked for Oracle Worked with Oracle DB Since 1982 (V2) Working with Exadata since early 2010 Work for Enkitec (www.enkitec.com) (Enkitec owns several Exadata s V2/X2/X3) (And Others BDA, Exalytics, ODA, etc ) Worked on a couple of books Hadoop Aficionado Exadata Fan Boy 12c Novice? Blog: kerryosborne.oracle-guy.com Twitter: @KerryOracleGuy 3

After Lunch Sessions 4

SQL Plan Management Framework Designed to prevent performance regression Not heavily adopted in 11g Uses Baselines - Signature (based on normalized sql text) - Hints - Plan_Hash_Value - Flags 5

SQL Plan Management Framework to provide stability Uses Baselines Goal is to use known plans - Test proposed plans before allowing them to run Based on Hints 6

Terminology SQL Plan Management (SPM) Framework Plan History Set of plans generated by the CBO SQL Plan Baseline Set of accepted plans for a SQL statement Also commonly used for a single plan (a baseline) Plan Evolution Process of adding ACCEPTED plans to the SQL Plan Baseline SQL Management Base (SMB) Part of the Dictionary that stores plans Plans History, SQL Plan Baseline and SQL Profiles 7

Flags Enabled Accepted Fixed Reproduced Adaptive new in 12c 8

Fixed? No they are not broken Fixed=Preferred Multiple plans can be fixed Optimizer will check all fixed plans before non-fixed Also causes interesting side effect - no new plans are added - not expected to evolve (i.e. fixed ) 9

Documented SPM Decision Tree * Assuming no fixed plans 10

Or Occasionally Like This * Assuming no fixed plans 11

12c Good News / Bad News Good News SPM Now stores the actual plan Can see non-reproducible plans Bad News Still Uses Hints 12

Display Non-Reproducible Plan 13

Automatic Capture? Upside: - Improves Stability - Keeps Repository of Potential Plans - Makes it Easy to Move Plans Between Systems Downside: - Accepts first plan that comes along - Can disable some other features (ACS, etc ) - Don t want to start capture until system is stable - There is overhead 14

Automatic Capture? OPTIMIZER_CAPTURE_SQL_PLAN_ BASELINES=TRUE Still not the default in 12c - still not the preferred approach? Note: Once a Baseline is created on a statement new plans will be added even if capture is off 15

Overhead? There is some - Extra parsing - Size of the SQLOBJ$AUXDATA 16

OEM Interface 17

Plan Evolution Step One Collect Plans Step Two Evaluate Plans Step Three Accept Better Plans 18

Plan Evolution 12c New SPM Evolve Advisor New AutoTask - SYS_AUTO_SPM_EVOLVE_TASK Enabled By Default Attempts to Verify New Plans Every Night Can auto evolve (1.5x improvement) - Improvement (based on etime, lio, cpu time) Non-Accepted not tried again for 30 days Produces Report 19

Plan Evolution 12c DBMS_SPM.REPORT_AUTO_EVOLVE_TASK 20

Manual Plan Evolution 12c New Task Oriented Approach Much Like SQL Tuning Advisor - Create Evolve Task (dbms_spm.create_evolve_task) - Execute Evolve Task (dbms_spm.execute_evolve_task) - Report Evolve Task (dbms_spm.report_evolve_task) - Accept Recommendation (dbms_spm.accept_sql_plan_baseline) Note: DBMS_SPM.EVOLVE_SQL_PLAN_BASELINE deprecated 21

Interaction with Adaptive Cursor Sharing (ACS) ACS fix for bind variable peeking ACS allows multiple execution plans per statement Capture automatically accepts first plan But Baselines allow multiple plans per statement as well This means Plans must be evolved in order to work well with ACS Otherwise you end up with this 22

Interaction with Adaptive Cursor Sharing (ACS) 12c auto evolve task 23

Interaction with Adaptive Optimization What s adaptive optimization? 24

What s the Point? (of Adaptive Optimization) Sometimes the Optimizer Makes Mistakes It s Often Pretty Easy to Spot the Mistakes Why Not Let the DB Fix the Mistakes on the Fly? 25

How Does the Optimizer Mess Up? Cardinality Misunderestimate mostly and it s pretty easy to recognize Estimated Rows Actual Rows 26

Cardinality Misunderestimate 27

Adaptive Execution Plans How Does it Work? Optimizer Can Change It s Mind in Mid-Execution But Don t Panic! Easy to See Only kicks in when it recognizes a mistake 28

Adaptive Execution Plans Rows coming out via inner nested loop are buffered up to a point. If row count exceeds threshold then switch to hash join. Alternative sub-plans are pre-computed Sub-plans stored in the cursor Stats collector inserted before join Rows buffered until final decision is made Table scan NESTED LOOPS Statistics Collector Index Scan HASH JOIN Table scan 29

Adaptive Execution Plans Statistics collector disabled after decision is made and becomes a pass through operation. Number of rows seen in statistics collector exceeds threshold Plan switches to hash join Statistics collector disabled Plan resolved on first execution & remains the same for subsequent executions Table scan NESTED LOOPS Statistics Collector Index Scan HASH JOIN Final Plan is a hash join Table scan 30

Interaction with Adaptive Plans Adaptive Plans Can Be Captured if no baseline exists (The Final Plan) if baseline exists, add default plan (mark as adaptive) Once Accepted No Longer Marked Adaptive 31

Wrap Up Change of Heart Capture Is Viable Now not enabled by default in 12c Evolve is Required Though enabled by default in 12c 12c Stores Plans so easier to diagnose reproducibility issues There are big companies using it in a big way There are companies that are misusing it 32

Questions? Contact Information : Kerry Osborne kerry.osborne@enkitec.com kerryosborne.oracle-guy.com www.enkitec.com 33