RBO RIP George Lumpkin Director Product Management Oracle Corporation Session id: 40178.

Slides:



Advertisements
Similar presentations
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Advertisements

Presented By Akin S Walter-Johnson Ms Principal PeerLabs, Inc
Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
M ODULE 4 D ATABASE T UNING Section 3 Application Performance 1 ITEC 450 Fall 2012.
© Bharati Vidyapeeths Institute of Computer Applications and Management, New Delhi © Bharati Vidyapeeths Institute of Computer Applications and.
1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Semantec Ltd. Oracle Performance Tuning Boyan Pavlov Indexes Indexes.
12 Copyright © 2005, Oracle. All rights reserved. Proactive Maintenance.
Agenda Overview of the optimizer How SQL is executed Identifying statements that need tuning Explain Plan Modifying the plan.
California State University Common Management Systems TUG Session: April 21, Overview Statistics in CMS PRD / Non-PRD Environments.
1 The Optimizer How ORACLE optimizes SQL statements David Konopnicky 1997, Revised by Mordo Shalom 2004.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 11 Database Performance Tuning and Query Optimization.
1 How to improve SQL Performance with new Health Check Tool? Carlos Sierra Consulting Technical Advisor © 2012 Oracle Corporation – Proprietary and Confidential.
AN INTRODUCTION TO EXECUTION PLAN OF QUERIES These slides have been adapted from a presentation originally made by ORACLE. The full set of original slides.
Relational Database Performance CSCI 6442 Copyright 2013, David C. Roberts, all rights reserved.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 11 Database Performance Tuning and Query Optimization.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Chapter 6 Additional Database Objects
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
Oracle Database Administration Lecture 6 Indexes, Optimizer, Hints.
Access Path Selection in a Relational Database Management System Selinger et al.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
The Self-Managing Database: Guided Application and SQL Tuning Mohamed Ziauddin Consulting Member of Technical Staff Oracle Corporation Session id:
1 Chapter 7 Optimizing the Optimizer. 2 The Oracle Optimizer is… About query optimization Is a sophisticated set of algorithms Choosing the fastest approach.
Administration and Monitoring the Database Oracle 10g.
11-1 Improve response time of interactive programs. Improve batch throughput. To ensure scalability of applications load vs. performance. Reduce system.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
What is a schema ? Schema is a collection of Database Objects. Schema Objects are logical structures created by users to contain, or reference, their data.
15 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Summary.
1 Chapter 10 Joins and Subqueries. 2 Joins & Subqueries Joins – Methods to combine data from multiple tables – Optimizer information can be limited based.
Oracle tuning: a tutorial Saikat Chakraborty. Introduction In this session we will try to learn how to write optimized SQL statements in Oracle 8i We.
Module 4 Database SQL Tuning Section 3 Application Performance.
© IBM Corporation 2005 Informix User Forum 2005 John F. Miller III Explaining SQLEXPLAIN ®
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Chapter 4 Logical & Physical Database Design
Chapter 5 Index and Clustering
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
10g Tuning Highlights Presenter JEREMY SCHNEIDER Senior Consultant, ITC Technology Services.
1 Chapter 9 Tuning Table Access. 2 Overview Improve performance of access to single table Explain access methods – Full Table Scan – Index – Partition-level.
Session id: Darrell Hilliard Senior Delivery Manager Oracle University Oracle Corporation.
David Konopnicki –1997, Rev. MS Optimizing Join Statements To choose an execution plan for a join statement, the optimizer must choose: ä Access.
DB Tuning : Chapter 10. Optimizer Center for E-Business Technology Seoul National University Seoul, Korea 이상근 Intelligent Database Systems Lab School of.
Sorting and Joining.
1 Chapter 8 Execution Plan Management. 2 Overview of Execution Plan Management Review techniques to – override optimizer – Improve optimizer’s decisions.
Confidencial - TRACASA Automatize test [e- Reporting]
Unit 6 Seminar. Indexed Organized Tables Definition: Index Organized Tables are tables that, unlike heap tables, are organized like B*Tree indexes.
Oracle9i Developer: PL/SQL Programming Chapter 11 Performance Tuning.
8 Copyright © 2005, Oracle. All rights reserved. Gathering Statistics.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
3 Copyright © 2006, Oracle. All rights reserved. Designing and Developing for Performance.
Closing the Query Processing Loop in Oracle 11g Allison Lee, Mohamed Zait.
Session Name Pelin ATICI SQL Premier Field Engineer.
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
McGraw-Hill/Irwin Copyright © 2005 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 9: Database Administration All Powder Board and Ski.
SQL Server Statistics and its relationship with Query Optimizer
Query Optimization Techniques
EVOLUTION OF THE ORACLE OPTIMIZER THINKING
Database Performance Tuning &
Query Tuning without Production Data
Database Performance Tuning and Query Optimization
Database Systems Instructor Name: Lecture-3.
Chapter 11 Database Performance Tuning and Query Optimization
Introduction to the Optimizer
Performance Tuning ETL Process
Presentation transcript:

RBO RIP George Lumpkin Director Product Management Oracle Corporation Session id: 40178

What, why, and how  What changes are made to the RBO in 10g  Why migrate to the CBO – CBO is proven – CBO provides all features necessary to simplify management – CBO enables many, many other database features  How to migrate to the CBO

Background: Query Optimization  One sentence definition: Find the most efficient mechanism for executing any SQL statement  A query optimizer is designed simplify SQL development – A query optimizer shields the application developer from the details of query execution  Two main components: – Query Transformations – Access Path Selection

Background: Query Optimization Query Transformations  Change fundamental structure of query to enable more possible execution strategies  Include view and subquery transformations, materialized view rewrites, star transformations, etc.  Example: select * from dept where deptno in (select deptno from emp where job = ‘CLERK’) select d.* from dept d, (select distinct deptno from emp where job = ‘CLERK’) e where d.deptno = e.deptno

Background: Query Optimization Access Path Selection  Construct the actual execution strategy to be used for a given query: – For each table, choose the access path (table scan, index scan, etc) – For each join, choose the join method (nested- loop, sort-merge, hash, etc) – Choose the join order for the tables  Can be viewed using Oracle’s EXPLAIN PLAN facility

Background: Query Optimization RBO vs. CBO  Oracle provides two query optimizers: – Rule-based optimizer (RBO)  Chooses an execution strategy based upon heuristics  Entirely deterministic based upon the schema and SQL statement – Cost-based optimizer (CBO)  Chooses an execution strategy based upon an estimated cost  Execution plans depends not only on the SQL and schema, but also the characteristics of the database objects and the amount of available resources

Background: Query Optimization CBO Statistics  CBO’s cost is based upon statistics – Database object statistics  Statistics which describe the database objects involved in the query, e.g., the number of rows in a table, the number of distinct values in a column, and the number of leaf blocks of an index. – CPU Statistics  Statistics on the relative performance of the hardware platform. – Buffer-cache statistics  Statistics that describe whether a given table or database object is typically cached or not.

What, why, and how  What changes are made to the RBO in 10g  Why migrate to the CBO – CBO is proven – CBO provides all features necessary to simplify management – CBO enables many, many other database features  How to migrate to the CBO

What is happening to the RBO  In Oracle Database 10g, the rule-based optimizer is no longer supported – The RBO is not ‘gone’ (at least not yet); it is simply not supported  No bugfixes will be provided to RBO for 10g  Almost no regression testing of RBO for 10g  In future releases, the RBO may be removed altogether – See support note : “Rule Based Optimizer is to be Desupported in Oracle10i” (May 2002)

What is happening to the RBO Reasons for de-supporting the RBO  The existence of the RBO prevents Oracle from making key enhancements to its query-processing engine – The removal of the RBO will permit Oracle to improve performance and reliability of the query-processing components of the database engine.  The use of the RBO prevents applications from leveraging many of the key features and enhancements introduced since Oracle7.  CBO is widely used today, by home-grown and third- party applications – 70-80% of applications using CBO today (per user surveys) – Adoption growing as more customers migrate to Oracle9i

What, why, and how  What changes are made to the RBO in 10g  Why migrate to the CBO – CBO is proven – CBO provides all features necessary to simplify management – CBO enables many, many other database features  How to migrate to the CBO

Peer pressure  Major applications use the CBO: – SAP – Oracle eBusiness Suite – Peoplesoft  User-group surveys show CBO is used in % of all applications – CBO adoption will continue to rise as more applications migrate to Oracle9i

Oracle11i E-Business Suite uses Cost-Based Optimizer  Huge optimizer workload: – 479,000 SQL statements – 24,000 tables – 40,000 indexes – 20,000 views – 30,000 packages – Queries referencing > 30 tables .25% of SQL statements (~1200 statements) required tuning/modification

What, why, and how  What changes are made to the RBO in 10g  Why migrate to the CBO – CBO is proven – CBO provides all features necessary to simplify management – CBO enables many, many other database features  How to migrate to the CBO

Oracle 10g: Zero-effort query optimization  Automatic statistics management  Enhanced query optimization  Automatic SQL Tuning

Gathering Optimizer Statistics Accurate optimizer statistics are crucial for good performance  Oracle8i: Good – Oracle provides robust DBMS_STATS package – DBA determines how to gather statistics – DBA determine when to gather statistics  Oracle9i: Better – Oracle determines how to gather statistics  Statistics can be gathered using a single command: execute DBMS_STATS.GATHER_DATABASE_STATS (OPTIONS=>’GATHER AUTO’); – DBA determines when to analyze statistics  In Oracle 10g, statistics are fully automated

Automatic Statistics Gathering in Oracle 10g  How it works: – Init.ora setup: STATISTICS_LEVEL = TYPICAL (or higher)  TYPICAL is the default setting – Statistics gathered as a predefined job (GATHER_STATS_JOB) scheduled by the unified scheduler  Statistics gathered using DBMS_STATISTICS package – Oracle implicitly determines:  The database objects which have missing or stale statistics  The appropriate sampling percentage necessary to gather good statistics on those objects  The appropriate columns which require histograms and the size for those histograms  The degree of parallelism for statistics-gathering

Complete statistics management  Statistics are automatically saved and can be restored – Old statistics can be viewed in the ALL/DBA/USER_OPT_STATS_HISTORY – Statistics are stored in the workload repository  Statistics can be locked – Auto-gathering processes will not modify locked statistics  Statistics can be manually specified by DBA – Using DBMS_STATS.SET_TABLE/INDEX_STATISTICS  Manual statistics gathering may still be required for: – Bulk loads (e.g. in data warehouse environments) – Volatile tables

Enhanced Query Optimization  Sophisticated cost model extensions – Broad cost model includes CPU and cache information  Graceful behavior with missing/incomplete statistics – ‘Dynamic statistics’ enabled by default

Automatic SQL Tuning Overview Detect Missing Indexes Detect Poor SQL Constructs Build a SQL Profile Automatic Tuning Optimizer SQL Structure Analysis Access Path Analysis SQL Profiling Statistics Analysis Detect Missing or Stale Statistics DBA Comprehensive SQL Tuning SQL Tuning Advisor See #40173: The Self-managing Database: Guided Application and SQL Tuning

What, why, and how  What changes are made to the RBO in 10g  Why migrate to the CBO – CBO is proven – CBO provides all features necessary to simplify management – CBO enables many, many other database features  How to migrate to the CBO

Features not supported by RBO  Data structures – Partitioning – Index-organized tables – Function-based indexes – Bitmap indexes  Access techniques – Parallel Execution – Full outer joins  Query transformations – Materialized views  Dozens more … (need to list optim features)

What, why, and how  What changes are made to the RBO in 10g  Why migrate to the CBO – CBO is proven – CBO provides all features necessary to simplify management – CBO enables many, many other database features  How to migrate to the CBO

Migration methodology  Create a test environment  Gather statistics  Determine init.ora settings  Validate performance  Migrate end-users

Create a test environment  Key technique #1: – If you have a test/dev system, you can export statistics from the production system to the test/dev system  Key technique #2: – If you do not have a suitable test system, you can test the CBO behavior on the production system 1.Set OPTIMIZER_MODE = RULE in init.ora 2.Gather optimizer statistics 3.In your test session, ALTER SESSION SET OPTMIZER_MODE = CHOOSE (or other appropriate setting)

Gather Statistics  ‘Bad’ statistics is the single most common cause of poor query optimization  Gather statistics on all database objects before trying the CBO

Determine appropriate init.ora settings  The key parameter is OPTIMIZER_MODE – Hint: FIRST_ROWS_n provides the most similar to RBO  Always start simple – Do not use other optimizer-related parameters until all choices of OPTIMIZER_MODE are considered

Validate performance  The most difficult step in the migration – Need to identify key SQL statements and compare performance  ‘Bad’ queries can be corrected using a variety of techniques: – Stored outlines – Hints – SQL modifications  ‘Bad’ queries should be rare – Note experience of Oracle eBusiness Suite  When testing using Oracle 10g, use Automatic SQL Tuning

Migrate end-users  End-users can be migrated one-by-one – Login trigger can set OPTIMIZER_MODE for each end-user

More info  : “Rule Based Optimizer is to be Desupported in Oracle10i”  : “Migrating to the Cost- Based Optimizer”  Documentation  White-paper