10g Tuning Highlights Presenter JEREMY SCHNEIDER Senior Consultant, ITC Technology Services.

Slides:



Advertisements
Similar presentations
Youre Smarter than a Database Overcoming the optimizers bad cardinality estimates.
Advertisements

Tuning Oracle SQL The Basics of Efficient SQLThe Basics of Efficient SQL Common Sense Indexing The Optimizer –Making SQL Efficient Finding Problem Queries.
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Presented By Akin S Walter-Johnson Ms Principal PeerLabs, Inc
Introduction to SQL Tuning Brown Bag Three essential concepts.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
SQL Server performance tuning basics
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
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.
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.
David Konopnicki Choosing Access Path ä The basic methods. ä The access paths and when they are available. ä How the optimizer chooses among the.
Virtual techdays INDIA │ 9-11 February 2011 SQL 2008 Query Tuning Praveen Srivatsa │ Principal SME – StudyDesk91 │ Director, AsthraSoft Consulting │ Microsoft.
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Optimizer. Types of Optimizers There are different modes for the optimizer RULE: Rule-based optimizer (RBO) –Deprecated; not updated since 1994.
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.
Optimization Exercises. Question 1 How do you think the following query should be computed? What indexes would you suggest to use? SELECT E.ename, D.mgr.
Oracle 10g Database Administrator: Implementation and Administration
Access Path Selection in a Relation Database Management System (summarized in section 2)
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.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Module 8 Improving Performance through Nonclustered Indexes.
Oracle Database Administration Lecture 6 Indexes, Optimizer, Hints.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
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:
RBO RIP George Lumpkin Director Product Management Oracle Corporation Session id:
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
Basic Optimization DB Workshop for LHC online/offline developers CERN January
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.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
SQL Performance and Optimization l SQL Overview l Performance Tuning Process l SQL-Tuning –EXPLAIN PLANs –Tuning Tools –Optimizing Table Scans –Optimizing.
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.
Indexes and Views Unit 7.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Chapter 5 Index and Clustering
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
1 Chapter 9 Tuning Table Access. 2 Overview Improve performance of access to single table Explain access methods – Full Table Scan – Index – Partition-level.
DB Tuning : Chapter 10. Optimizer Center for E-Business Technology Seoul National University Seoul, Korea 이상근 Intelligent Database Systems Lab School of.
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.
8 Copyright © 2005, Oracle. All rights reserved. Gathering Statistics.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
Dave LinkedIn
SQL Tuning Scripts Bobby Durrett US Foodservice
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
3 Copyright © 2006, Oracle. All rights reserved. Designing and Developing for Performance.
Oracle Database Architectural Components
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
Tuning Oracle SQL The Basics of Efficient SQL Common Sense Indexing
Choosing Access Path The basic methods.
Reading Execution Plans Successfully
Introduction to Execution Plans
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Reading Execution Plans Successfully
Introduction to Execution Plans
Introduction to Execution Plans
Introduction to the Optimizer
Understanding Oracle Optimizer: RBO versus CBO
Reading execution plans successfully
Introduction to Execution Plans
Presentation transcript:

10g Tuning Highlights

Presenter JEREMY SCHNEIDER Senior Consultant, ITC Technology Services OCP, RAC since 2002, Systems Admin and Developer in previous lives

Fundamentals Memory structures Storage structures

RBO vs CBO

1. Single Row by Rowid 2. Single Row by Cluster Join 3. Single Row by Hash Cluster Key with Unique or Primary Key 4. Single Row by Unique or Primary Key 5. Clustered Join 6. Hash Cluster Key 7. Indexed Cluster Key 8. Composite Index 9. Single-Column Indexes 10. Bounded Range Search on Indexed Columns 11. Unbounded Range Search on Indexed Columns 12. Sort Merge Join 13. MAX or MIN of Indexed Column 14. ORDER BY on Indexed Column 15. Full Table Scan Only single column indexes are ever merged. If all columns in an index are specified in the WHERE clause, that index will be used in preference to other indexes for which some columns are referenced. If multiple indexes can be applied to a WHERE clause, and they all have an equal number of columns specified, only the index created last will be used. If multiple columns of an index are being accessed with an = operator, that will override other operators such as LIKE or BETWEEN. Two ='s will override two ='s and a LIKE. A higher percentage of columns accessed will override a lower percentage of columns accessed. So generally, the optimizer will choose to use the index from which you specify the highest percentage of columns. However, as stated previously, all columns specified in a unique or primary key index will override the use of all other indexes. The RBO uses rules to select the driving table. If a WHERE clause has a column that is the leading column on any index, the rule-based optimizer will use that index. The exception is if a function is placed on the leading index column in the WHERE clause. *Check out

RBO vs CBO Based on advanced mathematics and statistics Default 80,000 permutations (optimizer_max_permutations)

RBO vs CBO SQL> desc all_tables Name Null? Type NUM_ROWS NUMBER BLOCKS NUMBER EMPTY_BLOCKS NUMBER AVG_SPACE NUMBER CHAIN_CNT NUMBER AVG_ROW_LEN NUMBER... SAMPLE_SIZE NUMBER LAST_ANALYZED DATE... GLOBAL_STATS VARCHAR2(3) USER_STATS VARCHAR2(3)... SQL> desc all_tab_columns Name Null? Type NUM_DISTINCT NUMBER LOW_VALUE RAW(32) HIGH_VALUE RAW(32) DENSITY NUMBER NUM_NULLS NUMBER NUM_BUCKETS NUMBER LAST_ANALYZED DATE SAMPLE_SIZE NUMBER... GLOBAL_STATS VARCHAR2(3) USER_STATS VARCHAR2(3) AVG_COL_LEN NUMBER... HISTOGRAM VARCHAR2(15)

Internal Structures & Algorithms Latches Enqueues Locks Pins Bitmaps Linked Lists Hash Maps Caching Sorting (opt,single,multi)

System Health Statspack Reports or AWR Reports (10g) DBControl

SQL Statement Tuning Methodology Don’t guess! Set goals and have a plan. Investigate scientifically. Oracle is very highly instrumented.

SQL Statement Top 10 Mistakes 1. Bad Connection Management 2. Bad Use of Cursors in the Shared Pool 3. Bad SQL 4. Nonstandard Initialization Parameters 5. Datafiles layed out poorly for I/O 6. Too few or too small redo logs (checkpoint errors) 7. Serialization – shortage of freelists, transactions slots or rollback segs 8. Inefficient full table scans 9. Large amount of recursive (SYS) SQL 10. Deployment/migration errors (e.g. missing indexes)

SQL Statement Tuning What can cause SQL execution to change? 1. Change in text of SQL statement (including hints) 2. Change in schema (indexes, parallel declarations, etc) 3. Change in object statistics 4. Change in system statistics 5. Change in system (init/spfile) or session parameters 6. Manipulation of Stored Outline or SQL Profile 7. Change in CBO code (i.e. upgrade or patch)

10g Tools for SQL Statement Tuning Explain plan (DBMS_XPLAN) Runtime Statistics (V$SESSTAT, V$SYSSTAT, V$PGASTAT) SQL Advisor SQLTrace (10046) and tkprof CBO Trace (10059) Stored Outlines Can use SQLPlus or DBControl

SQL Tuning Advisor SQL Tuning Advisor in Oracle 10g Workload SQL Tuning Candidates SQL Tuning Advisor ADDM AWR one hour Generate Recommendations DBA Invoke Advisor Implement DBA Evaluate Recommendations DBA Animation from Oracle

SQL Tuning Advisor 1. Create Index 2. Rewrite SQL (UNION ALL, NOT EXISTS, etc) 3. Gather Stats (stale or missing) 4. Create SQL Profile (correct cardinality or selectivity estimates, optimizer mode – only in comprehensive mode, not in limited mode)

Where to Learn More Documentation – tahiti.oracle.com Metalink and OTN Local User Group Online Community – Oracle Forums, oracle-l, c.d.o.s (usenet) Websites – asktom, oracle-base, orafaq, dizwell, jlcomp Blogs – Kyte, Lewis, Closson, Rittman Try things out on your own!

Questions, comments, suggestions? A Q &