The Self-Managing Database: Guided Application and SQL Tuning Mohamed Ziauddin Consulting Member of Technical Staff Oracle Corporation Session id: 40713.

Slides:



Advertisements
Similar presentations
Using the SQL Access Advisor
Advertisements

Oracle Enterprise Manager Grid Control: Day in the Life of An Admin Wilson N. López – Solution Specialist.
Copyright © SoftTree Technologies, Inc. DB Tuning Expert.
Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
13 Copyright © 2005, Oracle. All rights reserved. Monitoring and Improving Performance.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
Self-Validation Tech Guide
Self-Managing Database: Easy Upgrade Tom Graves Consulting Member of Technical Staff Oracle Corporation Session id:
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
IBM Software Group ® Recommending Materialized Views and Indexes with the IBM DB2 Design Advisor (Automating Physical Database Design) Jarek Gryz.
12 Copyright © 2005, Oracle. All rights reserved. Proactive Maintenance.
The Self-managing Database: Automatic Performance Diagnosis Graham Wood Kyle Hailey Oracle Corporation Session id:
Oracle Database 10g : The Self-Managing Database Richard Sarwal Vice President Oracle Corporation Session id:
Oracle 10g Database Administrator: Implementation and Administration Chapter 14 Proactive Maintenance.
Oracle 11g Real Application Testing: Avoiding Performance Regressions with SQL Performance Analyzer Khaled Yagoub, Pete Belknap, Benoit Dageville, Karl.
Simplify your Job – Automatic Storage Management Angelo Session id:
Maintaining a Microsoft SQL Server 2008 Database SQLServer-Training.com.
Database System Development Lifecycle © Pearson Education Limited 1995, 2005.
12 Copyright © 2004, Oracle. All rights reserved. Automatic Management.
Database Advisors Automatic Database Diagnostic Monitor ( ADDM )
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
® IBM Software Group © 2012 IBM Corporation OPTIM Data Studio – Jon Sayles, IBM/Rational November, 2012.
15 Copyright © 2004, Oracle. All rights reserved. Proactive Maintenance.
® Enterprise Manager/Management Packs Conference Call Phone Number: 1(888) Pass Code: CYBER.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Module 8 Improving Performance through Nonclustered Indexes.
Michael Sit Solution Specialists Manager Oracle Corporation.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
Simplified SQL Performance Management in Oracle Database 11g Pete Belknap.
1 Chapter 7 Optimizing the Optimizer. 2 The Oracle Optimizer is… About query optimization Is a sophisticated set of algorithms Choosing the fastest approach.
11-1 Improve response time of interactive programs. Improve batch throughput. To ensure scalability of applications load vs. performance. Reduce system.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 9: Database Administration Jerry Post Copyright © 2003.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
Carey Probst Technical Director Technology Business Unit - OLAP Oracle Corporation.
The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management Oracle Corporation.
1 Oracle Enterprise Manager Slides from Dominic Gélinas CIS
© IBM Corporation 2005 Informix User Forum 2005 John F. Miller III Explaining SQLEXPLAIN ®
7 Strategies for Extracting, Transforming, and Loading.
The Self-managing Database: Proactive Space and Schema Object Management Amit Ganesh Director, Data, Space and Transaction Processing Oracle Corporation.
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
20 Copyright © 2008, Oracle. All rights reserved. Cache Management.
Session id: Darrell Hilliard Senior Delivery Manager Oracle University Oracle Corporation.
Database Performance Eric Grancher - Nilo Segura Oracle Support Team IT/DES.
1 Chapter 8 Execution Plan Management. 2 Overview of Execution Plan Management Review techniques to – override optimizer – Improve optimizer’s decisions.
Oracle9i Developer: PL/SQL Programming Chapter 11 Performance Tuning.
13 Copyright © 2004, Oracle. All rights reserved. Optimizing Database Performance.
Execution Plans Detail From Zero to Hero İsmail Adar.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
3 Copyright © 2006, Oracle. All rights reserved. Designing and Developing for Performance.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
Closing the Query Processing Loop in Oracle 11g Allison Lee, Mohamed Zait.
Feature Overview Oracle Explorer – browse and alter schema Wizards and Designers Automatic code generation PL/SQL Editor with IntelliSense Oracle Data.
SQL Database Management
Data, Space and Transaction Processing
Table spaces.
How To Pass Oracle 1z0-060 Exam In First Attempt?
Antonio Abalos Castillo
Performance Management
Get Verified Oracle 1z0-062 Study Material - Oracle 1z0-062 Exam Dumps PDF Realexamdumps.com
SQL Server 2016 Query Data Store
Managing Performance by SQL Tuning
Recommending Materialized Views and Indexes with the IBM DB2 Design Advisor (Automating Physical Database Design) Jarek Gryz.
Presentation transcript:

The Self-Managing Database: Guided Application and SQL Tuning Mohamed Ziauddin Consulting Member of Technical Staff Oracle Corporation Session id: 40713

Agenda  SQL Tuning Challenges  Automatic SQL Tuning Overview  Usage Scenarios – High load SQL tuning – Custom SQL workload tuning  User Interface – Enterprise Manager – DBMS_SQLTUNE PL/SQL package  Conclusion

Manual SQL Tuning Challenges DBA How can I tune high-load SQL? High-Load SQL SQL Workload DBA How can I select high-load SQL?

Manual SQL Tuning Challenges  Requires expertise in several domains – SQL optimization: adjust the execution plan – Access design: provide fast data access – SQL design: use appropriate SQL constructs  Time consuming – Each SQL statement is unique – Potentially large number of statements to tune  Never ending task – SQL workload always evolving – Plan regressions

An Example Tuning Scenario Manual Tuning 1.Get explain plan 2.Examine query objects and their sizes 3.Review and compare explain plan statistics with execution statistics (stored in V$SQL view) 4.Identify that it is a “ first rows ” issue because only recent data is ever displayed despite large history being queried 5.Contact application vendor 6.Produce test case for vendor 7.Get a patch with “ first rows ” hint from the vendor 8.Install the patch in next maintenance cycle Problem: Incorrect Optimizer Mode Selection

Intelligent Infrastructure Application & SQL Management System Resource Management Space Management Backup & Recovery Management Storage Management Database Control Database Management Oracle 10g – SQL Tuning Solution

Oracle 10g Automates the SQL Tuning Process I can do it for you ! SQL Tuning Advisor DBA High-Load SQL ADDM SQL Workload

Agenda  SQL Tuning Challenges  Automatic SQL Tuning Overview  Usage Scenarios – High load SQL tuning – Custom SQL workload tuning  User Interface – Enterprise Manager – DBMS_SQLTUNE PL/SQL package  Conclusion

Automatic SQL Tuning Overview Add Missing Indexes Modify SQL Constructs Create a SQL Profile Automatic Tuning Optimizer SQL Structure Analysis Access Path Analysis SQL Profiling Statistics Analysis Gather Missing or Stale Statistics DBA SQL Tuning Recommendations SQL Tuning Advisor

Automatic Tuning Optimizer (ATO)  It is the query optimizer running in tuning mode – Uses same plan generation process but performs additional steps that require lot more time  It performs verification steps – To validate statistics and its own estimates  Uses dynamic sampling and partial executions to validate  It performs exploratory steps – To investigate the use of new indexes that could provide significant speed-up – To analyze SQL constructs that led to expensive plan operators

Statistics Analysis Add Missing Indexes Modify SQL Constructs Create a SQL Profile Automatic Tuning Optimizer SQL Structure Analysis Access Path Analysis SQL Profiling Statistics Analysis Gather Missing or Stale Statistics DBA SQL Tuning Recommendations SQL Tuning Advisor

Statistics Analysis  Motivation – Statistics are key input to the query optimizer  Their availability and accuracy is very important  In Oracle10g, the Automatic statistics collection maintains statistics up to date… – But it may not be enabled or properly configured !  The ATO verifies statistics that it needs/uses – Generates auxiliary information to compensate for missing or stale statistics – Generates recommendations to gather statistics where appropriate

SQL Profiling Add Missing Indexes Modify SQL Constructs Create a SQL Profile Automatic Tuning Optimizer SQL Structure Analysis Access Path Analysis SQL Profiling Statistics Analysis Gather Missing or Stale Statistics DBA SQL Tuning Recommendations SQL Tuning Advisor

SQL Profiling  Motivation – Empower the query optimizer to find a better plan  The query optimizer has time constraints – Makes compromises while finding right plan  The ATO is allowed a lot more time – Uses the time to gather customized information about the SQL statement, known as SQL Profile – Builds a SQL Profile and recommends it – Once implemented, SQL Profile is used by the query optimizer to generate a well-tuned plan

SQL Profiling Flow Optimizer ( Tuning Mode ) create submit SQL Profiling Optimizer ( Normal Mode) output submit SQL Profile SQL Tuning Advisor Database Users Well-Tuned Plan After … use

SQL Profile  It contains auxiliary information collected by the ATO for a SQL statement – Customized optimizer settings  Based on past execution history (e.g., first_rows vs. all_rows) – Compensation for missing or stale statistics – Compensation for errors in optimizer estimates  Estimation errors occur due to data skews and correlations, complex filters and joins  It doesn’t require any change to the SQL text – Ideal for Packaged Apps  It is persistent – Works across shutdowns and upgrades

Access Path Analysis Add Missing Indexes Modify SQL Constructs Create a SQL Profile Automatic Tuning Optimizer SQL Structure Analysis Access Path Analysis SQL Profiling Statistics Analysis Gather Missing or Stale Statistics DBA SQL Tuning Recommendations SQL Tuning Advisor

Access Path Analysis  Motivation – Adding an index may significantly improve the performance of a SQL statement  Problem: A critical access path is missing – Index not created or mistakenly dropped  ATO explores the use of new indexes – Recommends an index if it provides a major performance boost – Also recommends to run SQL Access Advisor to get comprehensive index analysis based on a workload  SQL Access Advisor also uses this analysis mode

SQL Structure Analysis Add Missing Indexes Modify SQL Constructs Create a SQL Profile Automatic Tuning Optimizer SQL Structure Analysis Access Path Analysis SQL Profiling Statistics Analysis Gather Missing or Stale Statistics DBA SQL Tuning Recommendations SQL Tuning Advisor

SQL Structure Analysis  Motivation – Help application developers identify poorly written SQL statements – Suggest restructuring of SQL for efficiency  Problem categories – Semantic changes of SQL operators (e.g., use UNION ALL instead of UNION)  Subject to user acceptance of new result – Syntactic changes to predicates on indexed columns (e.g., remove type mismatch in column = :bind) – Design issues (e.g., add missing join predicate to eliminate a large Cartesian join)

Agenda  SQL Tuning Challenges  Automatic SQL Tuning Overview  Usage Scenarios – High load SQL tuning – Custom SQL workload tuning  User Interface – Enterprise Manager – DBMS_SQLTUNE PL/SQL package  Conclusion

SQL Tuning Usage Scenarios SQL Tuning Advisor ADDM High-load SQL Cursor Cache AWR SQL Tuning Set (STS) User-defined Filter / Rank SQL Sources Manual Selection Automatic Selection AWR

SQL Tuning Set (STS)  Motivation – Enable user to tune a custom set of SQL statements  It is a new object in Oracle10g for capturing SQL workload  It stores SQL statements along with.. – Execution context: parsing user, bind values, etc. – Execution statistics: buffer gets, CPU time, elapse time, number of executions, etc.  It is created from a SQL source – Sources: AWR, cursor cache, user-defined SQL workload, another STS

SQL Tuning Set Benefits  Allows selective, on-demand, custom SQL workload tuning  It simplifies tuning of a large number of SQL statements  It is persistent  Provides a common infrastructure for dealing with SQL workloads – Can be used as a source for different tuning tasks

Agenda  SQL Tuning Challenges  Automatic SQL Tuning Overview  Usage Scenarios – High load SQL tuning – Custom SQL workload tuning  User Interface – Enterprise Manager – DBMS_SQLTUNE PL/SQL package  Conclusion

Enterprise Manager Interface  Launch SQL Tuning Advisor from a SQL Source page – ADDM Finding page, or – Top SQL page, or – SQL Tuning Set (STS) page  View SQL Tuning Recommendations  Implement SQL Tuning Recommendations

SQL Source: ADDM Finding

SQL Source: Top SQL

SQL Source: SQL Tuning Set

SQL Tuning Options

Enterprise Manager Interface  Launch SQL Tuning Advisor from a SQL Source page – ADDM Finding page, or – Top SQL page, or – SQL Tuning Set (STS) page  View SQL Tuning Recommendations  Implement SQL Tuning Recommendations

SQL Tuning Recommendations — Overview

SQL Tuning Recommendations — Details

Enterprise Manager Interface  Launch SQL Tuning Advisor from a SQL Source page – ADDM Finding page, or – Top SQL page, or – SQL Tuning Set (STS) page  View SQL Tuning Recommendations  Implement SQL Tuning Recommendations

Implement Recommendations

Agenda  SQL Tuning Challenges  Automatic SQL Tuning Overview  Usage Scenarios – High load SQL tuning – Custom SQL workload tuning  User Interface – Enterprise Manager – DBMS_SQLTUNE PL/SQL package  Conclusion

DBMS_SQLTUNE PL/SQL Package  Contains API for SQL Tuning – Create Tuning Task – Execute Tuning Task – Display Advisor Recommendations – Drop Tuning Task – Create STS – Populate STS – Query STS Contents – Drop STS – Accept SQL Profile – Drop SQL Profile – Alter SQL Profile Attribute Tuning Task Management STS Management SQL Profile Management

Conclusion Manual Tuning 1.Get explain plan 2.Examine query objects and their sizes 3.Review and compare explain plan statistics with execution statistics (stored in V$SQL view) 4.Identify that it is a “ first rows ” issue because only recent data is ever displayed despite large history being queried 5.Contact application vendor 6.Produce test case for vendor 7.Get a patch with “ first rows ” hint from the vendor 8.Install the patch in next maintenance cycle Automatic Tuning 1.Run SQL Tuning Advisor 2.Implement SQL profile Problem: Incorrect Optimizer Mode Selection

Recommended Sessions/Demos  Automatic SGA Memory Management (Tuesday, 5 PM, Room 103)  The Invisible Oracle: Deploying Oracle DB in Embedded Environments (Wednesday, 4:30 PM, Room 103  Automatic Health Monitoring (Thursday, 11:00 AM, Room 103  Proactive Performance Management  Automatic Memory Management  Proactive Space Management  Invisible Installation & Deployment  Automatic Storage Management  Easy Upgrade Technical SessionsCampground Demos

Reminder – Please complete the OracleWorld online session survey. This was Session # Thank you.

A Q & Q U E S T I O N S A N S W E R S