EVOLUTION OF THE ORACLE OPTIMIZER THINKING

Slides:



Advertisements
Similar presentations
Tuning Oracle SQL The Basics of Efficient SQLThe Basics of Efficient SQL Common Sense Indexing The Optimizer –Making SQL Efficient Finding Problem Queries.
Advertisements

Introduction to SQL Tuning Brown Bag Three essential concepts.
Copyright © SoftTree Technologies, Inc. DB Tuning Expert.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
IO Waits Kyle Hailey #.2 Copyright 2006 Kyle Hailey Waits Covered in this Section  db file sequential read  db file scattered.
1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Performance And Tuning – Lecture 7 Copyright System Managers LLC 2007 all rights reserved.
David Konopnicki Choosing Access Path ä The basic methods. ä The access paths and when they are available. ä How the optimizer chooses among the.
Query Optimization 3 Cost Estimation R&G, Chapters 12, 13, 14 Lecture 15.
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.
Boris Gurov Support Analyst Oracle Bulgaria All you need to know about Oracle Indexes.
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
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 11 Database Performance Tuning and Query Optimization.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Oracle Database Administration Lecture 6 Indexes, Optimizer, Hints.
Strength. Strategy. Stability.. Progress Performance Monitoring and Tuning Dan Foreman Progress Expert BravePoint BravePoint
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
RBO RIP George Lumpkin Director Product Management 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.
Query Optimization Chap. 19. Evaluation of SQL Conceptual order of evaluation – Cartesian product of all tables in from clause – Rows not satisfying where.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
Persistent Systems Limited “Bhageerath”, 402, Senapati Bapat Road,Pune , Ph No: Santosh Kangane 1.
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.
SEMANTEC 1 Oracle Performance Tuning - Part I Krasen Paskalev Oracle 8i Certified DBA.
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.
1 Logical I/O Julian Dyke Independent Consultant Web Version juliandyke.com © 2005 Julian Dyke.
Query Optimization CMPE 226 Database Systems By, Arjun Gangisetty
IMS 4212: Database Implementation 1 Dr. Lawrence West, Management Dept., University of Central Florida Physical Database Implementation—Topics.
1 Chapter 9 Tuning Table Access. 2 Overview Improve performance of access to single table Explain access methods – Full Table Scan – Index – Partition-level.
Query Processing – Implementing Set Operations and Joins Chap. 19.
Execution Plans Detail From Zero to Hero İsmail Adar.
Same Plan Different Performance Mauro Pagano. Consultant/Developer/Analyst Oracle  Enkitec  Accenture DBPerf and SQL Tuning Training Tools (SQLT, SQLd360,
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
Tuning Oracle SQL The Basics of Efficient SQL Common Sense Indexing
CHAPTER 19 Query Optimization. CHAPTER 19 Query Optimization.
Giving the CBO what it craves: Input!
SQL Tuning.
CS 540 Database Management Systems
Lecture 16: Data Storage Wednesday, November 6, 2006.
Query Optimization Kush Kashyap B.Tech -IT.
Database Performance Tuning &
Query Tuning without Production Data
Choosing Access Path The basic methods.
Optimizing SQL Queries
Database Performance Tuning and Query Optimization
COST ESTIMATION FOR THE RELATIONAL ALGEBRA OPERATIONS MIT 813 GROUP 15 PRESENTATION.
Chapter 15 QUERY EXECUTION.
Examples of Physical Query Plan Alternatives
Cse 344 April 25th – Disk i/o.
Physical Database Design
External Sorting The slides for this text are organized into chapters. This lecture covers Chapter 11. Chapter 1: Introduction to Database Systems Chapter.
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Selected Topics: External Sorting, Join Algorithms, …
Troubleshooting Techniques(*)
Performance And Scalability In Oracle9i And SQL Server 2000
Chapter 12 Query Processing (1)
Chapter 11 Database Performance Tuning and Query Optimization
CS222P: Principles of Data Management Notes #13 Set operations, Aggregation, Query Plans Instructor: Chen Li.
Evaluation of Relational Operations: Other Techniques
Performance And Scalability In Oracle9i And SQL Server 2000
Jean Joseph DBA\DEVELOPER
Introduction to the Optimizer
SQL Performance for DBAs
Unit 12 Index in Database 大量資料存取方法之研究 Approaches to Access/Store Large Data 楊維邦 博士 國立東華大學 資訊管理系教授.
Presentation transcript:

EVOLUTION OF THE ORACLE OPTIMIZER THINKING Jurijs Velikanovs 7+ years Oracle DBA, OCP 7/8/8i/9i, OCA 9iAS R2

DEMO! Topics: Definition of database optimizer Death of RBO or Why CBO is better Limitations of earlier CBO versions Some ways to workaround 8i + 9i Revolution DEMO!

About myself Introduction 8 years as Oracle DBA Master degree in computer since 8 years as Oracle DBA OCP 7/8/8i/9i, OCA 9iAS R2 Oracle9i Database Administrator Certified Master http://otn.oracle.com/ocm/jvelikanovs.html 7+ in IT Alise First line Oracle support analyst Development DBA, Consultant DBA Teamleader

About IT Alise Introduction ~200 employees Main working directions 10+ years experience in Oracle development ~200 employees Main working directions Oracle Custom Development Oracle eBusiness Suite implementation Oracle Expert services

Definition of database optimizer

Definition of optimizer Oracle9i Database Concepts “The optimizer determines the most efficient way to run a SQL statement.”

Definition of optimizer Nowadays it means my opinion ”If application design reflects business needs you don’t have to think about particular SQL performance” I. Optimizer will find optimal path himself II. You still have to think about application design

Death of RBO ! or Why CBO is Better ?

DEMO! INDEX & RBO  tfc1/2/3.sql

Technically can’t choose optimal way RBO Technically can’t choose optimal way Don’t know anything about data distribution There is set of rules You have to think about execution plan writing SQL Stabile life. SQL executes equally: yesterday/today/tomorrow RBO is dead  But what would say CBO? DEMO tfc2.sql

CBO How CBO found the way? Main Characteristics DEMO event 10053 tfc4.sql PARAMETERS USED BY THE OPTIMIZER BASE STATISTICAL INFORMATION SINGLE TABLE ACCESS PATH OPTIMIZER STATISTICS AND COMPUTATIONS GENERAL PLANS Main Characteristics Works using statistics Looks through “all” possible paths Calculates COST and choose path with lowest cost There a lot of assumption

Limitations of earlier CBO versions

DB_FILE_MULTIBLOCK_READ_COUNT FULL SCAN cost DEMO tfc4sql ‘adjusted’ multi-block read value for COST calculation number of blocks / aMBRC Some blocks can be in memory Don’t do MBR across extents Oracle don’t believe you (MBRC) All IO are equal Single block read = Multiblock read time

Limitations of earlier CBO (COST) All IO are equal Single block read = Multiblock read time Think in PIO units LIO = PIO (buffer pool?) All Join operations speed are equal Full Scan = Nested Loop = Hash Join = Merge Join … All other operation ignored Comparization, Functions, …

Some ways to workaround 8i +

Some ways to workaround 8i + Think in PIO units LIO = PIO (buffer pool?) OPTIMIZER_INDEX_CACHING (o_i_c) Measurement 0-100% Default value are far from real world = 0% How many blocks accessible via “db file sequential read” are in the cache 'buffer cache hit ratio'

Some ways to workaround 8i + All IO are equal Single block read = Multiblock read time OPTIMIZER_INDEX_COST_ADJ (o_i_c_a) Measurement 0-10000% Default value are far from real world = 100% “db file sequential read” cost * o_i_c_a = REAL COST “db file sequential reads” / ”db file scattered read” DEMO tfc5sql

Do not underestimate parameters impact Conclusion 8i Do not underestimate parameters impact DB_FILE_MULTIBLOCK_READ_COUNT OPTIMIZER_INDEX_CACHING OPTIMIZER_INDEX_COST_ADJ Default values far from real world needs OPTIMIZER_INDEX_CACHING=0% OPTIMIZER_INDEX_COST_ADJ=100%

9i Revolution

9i Revolution = SYSTEM_STATS Compute DBMS_STATS. GATHER_SYSTEM_STATS(gathering_mode => 'START'); DO THE LOAD … DBMS_STATS. GATHER_SYSTEM_STATS(gathering_mode => 'STOP'); Retrieve select * from sys.aux_stats$; DEMO ss.sql

Part 1: Multi block reads Statistics computed SREADTIM: Average time for a single-block read request in milliseconds MREADTIM: Average time for a multi-block read request in milliseconds MBRC: Average number of blocks in a multi-block read. FullScan time = MREADTIM * BLOKS / MBRC Cost = FullScan time /SREADTIM Cost = Response time measured in single block reads DEMO tfc6.sql

Part 2: CPU Costing Model Statistics computed CPUSPEED: Oracle calibration of system CPU speed Costing formula (Oracle9i Database Performance Tuning Guide and Reference) : COST = ( #SRds * SREADTIM + #MRds * MREADTIM + #CPUCycles / CPUSPEED ) / SREADTIM CPUCycles Virtually every operation have cost in terms of CPU usage HASH/SORT/PREDICATES SEARCH/IRS/IUS/TFS... There is internal Oracle table for operation calibration Model allows measure CPU usage DEMO ss1.sql

Conclusion It is really REVOLUTION! RBO is dead !!! The CBO keeps evolving Statistics & Parameters are essential Lot of wrong assumptions in earlier versions 9i+ revolutionary switch SYS_STATs There are still assumptions Design is most important! And now you can have time for design!

Jurijs Velikanovs Q&A +371-9268222 J.Velikanovs@alise.lv http://otn.oracle.com/ocm

Show Time @testsort @test_b1 @test_b2 @test_b3 @test_b4