Advanced Oracle SQL Tuning



Similar documents
Oracle Database 11g: SQL Tuning Workshop

Oracle Database 11g: SQL Tuning Workshop Release 2

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

Oracle EXAM - 1Z Oracle Database 11g Release 2: SQL Tuning. Buy Full Product.

Oracle Database 11 g Performance Tuning. Recipes. Sam R. Alapati Darl Kuhn Bill Padfield. Apress*

Oracle Architecture, Concepts & Facilities

Programa de Actualización Profesional ACTI Oracle Database 11g: SQL Tuning Workshop

D B M G Data Base and Data Mining Group of Politecnico di Torino

An Oracle White Paper May Guide for Developing High-Performance Database Applications

Oracle DBA Course Contents

Introduction to SQL Tuning. 1. Introduction to SQL Tuning SkillBuilders, Inc. SKILLBUILDERS

1. This lesson introduces the Performance Tuning course objectives and agenda

An Oracle White Paper May The Oracle Optimizer Explain the Explain Plan

Performance Tuning and Optimizing SQL Databases 2016

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs.

SQL Server Performance Tuning and Optimization

SQL Query Performance Tuning: Tips and Best Practices

SQL Performance for a Big Data 22 Billion row data warehouse

Oracle Database 11g: Performance Tuning DBA Release 2

Microsoft SQL Server: MS Performance Tuning and Optimization Digital

Query Optimization in Oracle 12c Database In-Memory

Basic Tuning Tools Monitoring tools overview Enterprise Manager V$ Views, Statistics and Metrics Wait Events

SQL Server Query Tuning

DB2 for Linux, UNIX, and Windows Performance Tuning and Monitoring Workshop

SQL Server Query Tuning

MS SQL Performance (Tuning) Best Practices:

Best Practices for DB2 on z/os Performance

Course 55144B: SQL Server 2014 Performance Tuning and Optimization

SQL Query Evaluation. Winter Lecture 23

Physical Database Design and Tuning

1. Physical Database Design in Relational Databases (1)

Optimizing Your Database Performance the Easy Way

Bloom Filters. Christian Antognini Trivadis AG Zürich, Switzerland

Introduction. Part I: Finding Bottlenecks when Something s Wrong. Chapter 1: Performance Tuning 3

W I S E. SQL Server 2008/2008 R2 Advanced DBA Performance & WISE LTD.

Instant SQL Programming

Objectif. Participant. Prérequis. Pédagogie. Oracle Database 11g - Performance Tuning DBA Release 2. 5 Jours [35 Heures]

Database Programming with PL/SQL: Learning Objectives

PERFORMANCE TUNING FOR PEOPLESOFT APPLICATIONS

IBM DB2: LUW Performance Tuning and Monitoring for Single and Multiple Partition DBs

DBMS / Business Intelligence, SQL Server

Business Application Services Testing

MS Designing and Optimizing Database Solutions with Microsoft SQL Server 2008

Performance rule violations usually result in increased CPU or I/O, time to fix the mistake, and ultimately, a cost to the business unit.

LearnFromGuru Polish your knowledge

The Sins of SQL Programming that send the DB to Upgrade Purgatory Abel Macias. 1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

Oracle Database 10g. Page # The Self-Managing Database. Agenda. Benoit Dageville Oracle Corporation benoit.dageville@oracle.com

Course 55144: SQL Server 2014 Performance Tuning and Optimization

Oracle Database: SQL and PL/SQL Fundamentals NEW

IBM WebSphere DataStage Online training from Yes-M Systems

Oracle Database: SQL and PL/SQL Fundamentals

"Charting the Course... MOC AC SQL Server 2014 Performance Tuning and Optimization. Course Summary

Oracle Database 12c: Performance Management and Tuning NEW

SQL Optimization & Access Paths: What s Old & New Part 1

Contents at a Glance. Contents... v About the Authors... xiii About the Technical Reviewer... xiv Acknowledgments... xv

Execution Plans: The Secret to Query Tuning Success. MagicPASS January 2015

Understanding Query Processing and Query Plans in SQL Server. Craig Freedman Software Design Engineer Microsoft SQL Server

low-level storage structures e.g. partitions underpinning the warehouse logical table structures

AV-005: Administering and Implementing a Data Warehouse with SQL Server 2014

Physical DB design and tuning: outline

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 11g: Administer a Data Warehouse

Performance Tuning for the Teradata Database

Query tuning by eliminating throwaway

Expert Oracle. Database Architecture. Techniques and Solutions. 10gr, and 11g Programming. Oracle Database 9/, Second Edition.

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle 10g PL/SQL Training

Guide to Performance and Tuning: Query Performance and Sampled Selectivity

DB2 LUW Performance Tuning and Monitoring for Single and Multiple Partition DBs

PERFORMANCE TIPS FOR BATCH JOBS

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

Oracle Database: SQL and PL/SQL Fundamentals

FHE DEFINITIVE GUIDE. ^phihri^^lv JEFFREY GARBUS. Joe Celko. Alvin Chang. PLAMEN ratchev JONES & BARTLETT LEARN IN G. y ti rvrrtuttnrr i t i r

Understanding SQL Server Execution Plans. Klaus Aschenbrenner Independent SQL Server Consultant SQLpassion.at

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/-

Building a Hybrid Data Warehouse Model

Topics Advanced PL/SQL, Integration with PROIV SuperLayer and use within Glovia

SQL Server 2012 Optimization, Performance Tuning and Troubleshooting

Expert Oracle Exadata

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

SQL Tuning Proven Methodologies

Real-Time SQL Monitoring. December 2009

Course -Oracle 10g SQL (Exam Code IZ0-047) Session number Module Topics 1 Retrieving Data Using the SQL SELECT Statement

Query Performance Tuning: Start to Finish. Grant Fritchey

In this session, we use the table ZZTELE with approx. 115,000 records for the examples. The primary key is defined on the columns NAME,VORNAME,STR

Oracle Database In- Memory Op4on in Ac4on

Response Time Analysis

Data Integration and ETL with Oracle Warehouse Builder: Part 1

Course Outline. SQL Server 2014 Performance Tuning and Optimization Course 55144: 5 days Instructor Led

SQL Server Administrator Introduction - 3 Days Objectives

Tune That SQL for Supercharged DB2 Performance! Craig S. Mullins, Corporate Technologist, NEON Enterprise Software, Inc.

Oracle SQL. Course Summary. Duration. Objectives

Indexing Techniques for Data Warehouses Queries. Abstract

White Paper. Optimizing the Performance Of MySQL Cluster

How To Improve Performance In A Database

Technical Comparison of Oracle Database vs. SQL Server 2000: Focus on Performance. An Oracle White Paper December 2003

Would-be system and database administrators. PREREQUISITES: At least 6 months experience with a Windows operating system.

Transcription:

Advanced Oracle SQL Tuning Seminar content technical details 1) Understanding Execution Plans In this part you will learn how exactly Oracle executes SQL execution plans. Instead of describing on PowerPoint sides how things might logically happen in Oracle, we will take a deep dive into the exact sequence of how Oracle physically executes the row sources in any execution plan and how does the data flow during plan execution. You will learn how access path operators fetch rows from database segments and how the rows are passed through the execution plan tree throughout the lifecycle of SQL execution. You will also learn how row joining, filtering and comparison works, such as nested loop/hash joins and also the frequently seen FILTER operation. The understanding of how SQL plan execution physically works will become a strong and required foundation for any systematic SQL tuning and troubleshooting task. Understanding SQL Plan Execution and Data Flow A detailed look into how SQL plan execution works in Oracle o Walking the execution plan tree o Understanding row source operators o Buffering vs. cascading row sources Getting execution plans from the right source Reading execution plans the right way Identifying where the response time is spent Profiling SQL plan execution o V$SQL_PLAN_STATISTICS_ALL o SQL Trace STAT lines o Real time SQL monitoring and V$SQL_MONITOR o OS tools (os_explain, DTrace) Predicates and data filtering Access vs. filter predicates INTERNAL_FUNCTION and pushed predicates Understanding how the data joining and correlated lookups work Nested Loop Joins Hash Joins o Partition-wise joins Merge Joins Correlated subquries and FILTER operation Connect By operation Understanding the fundamental factors affecting query performance

Row counts fetched from a row source (cardinality) Block visits and revisits Locality of data DML: Amount of data changed (redo/undo size) Lock and latch contention PX: Parallel execution data fetch and distribution mechanism Callouts from SQL execution plan (PL/SQL function calls from SQL) Understanding why can SQL performance change even though the execution plan hasn t changed Amount of work area memory allowed to use by work area manager Hash multipass join decisions Dynamic hash input swapping Number of parallel slaves currently available Runtime prefetching decisions o Nested loop prefetching o Direct read segment scan prefetching o Index multiblock read prefetching 2) Controlling SQL Execution Plans In this part you will learn how to make a SQL execution plan do exactly what you want it to do. We will look into the full range of techniques such as query rewriting, full hinting, stored outlines, SQL profiles, adjusting row count estimates and passing optimizer parameters into individual statements. We will start from identifying important prerequisites to any systematic SQL tuning, such as understanding the amount and shape of data accessed and what is the SQL statement supposed to do. This allows you to understand what would be the ideal execution order and hierarchy which you can then achieve with the techniques covered next in this section. As no SQL tuning technique is appropriate in all situations, we will also look into how to pick the right technique for fixing the right problem and common SQL optimization pitfalls. Three main properties of an execution plan - data retrieval Join order (execution order and hierarchy) Join methods Access paths Controlling execution plans Picking the right join order Picking the right join methods Picking the right access paths

Understanding query transformations Heuristic query transformations Cost based query transformations (CBQT) Simple view merging Complex view merging Subquery unnesting, antijoin, semijoin conversions o IN, NOT IN, EXISTS, NOT EXISTS Join elimination transformations Predicate move-around Others Controlling work area operations and reducing memory usage Sorting, grouping and other work area operations Making the SQL execution plan do exactly what you want and always Hinting the right way Hinting pitfalls and what to avoid Using SQL profiles Adjusting schema object statistics Using stored outlines Strategy and techniques for achieving execution plan stability 3) Accessing Data Efficiently In this part we will go deep into efficient ways of retrieving data from the database (accessing rows using table, index access paths etc). We will look into how to systematically detect inefficient data access even if nobody is complaining (yet) about performance. A large majority of this section focuses on indexes, how they work, how to use them, how to avoid using them. After completing this part, you will be able to systematically work out which columns and in which order would give the best results for a workload there s no need for repetitive trial and error! Mantras of efficient SQL execution Don t request too much work! o Let the database know about your intentions o Ask only the columns you need o Ask only the amount of rows you need o Ask only the detail you need o Help Oracle to know the data Don t do too much work! (Simple, huh? ) o Retrieve data efficiently reduce number of IO-s per row retrieved by access path o Filter data early eliminate non-matching rows close to the access path

o Process retrieved data efficiently avoid heavy loops and iterations Achieving efficient data access Understanding the data retrieval overhead of different access paths Identifying significant throw-away of retrieved data Using the right access paths for retrieving data Filtering data early Systematic indexing How to know in advance which indexes would help with data retrieval performance Calculating the best column order for multicolumn indexes Understanding lookup overhead of indexes Understanding why the index clustering factor matters so much Understanding index maintenance overhead Indexing strategy for high-concurrency updates and insert distribution of right hand indexes (and RAC) Reverse-key indexes Index column prefixing with instance ID Index column prefixing with a deterministic function Best practices for bitmap indexing Avoiding heavy DML on bitmap indexes Achieving efficient bitmap index combining Achieving star transformation in star schemas 4) Helping Cost Based Optimizer to Find Good Plans While the past parts of this seminar give you the knowledge of how to optimize SQL and control execution plans yourself, it is not realistic to manually tune every SQL statement yourself. This is exactly why the Cost Based Optimizer exists. Unfortunately Oracle s Cost Based Optimization process is not perfect; in some cases because of the Optimizer s design limitations, sometimes bugs, but often because incorrectly configured optimizer environment and statistics collection setup. This part of the seminar provides you the required understanding of CBO internals and SQL plan execution s cost estimation process. Armed with this knowledge you will learn how to put together a strategy for configuring Cost Based Optimizer environment and statistics collection correctly. We will look into different requirements by different workloads (such as OLTP vs. DSS systems). Additionally we will look into how to systematically work out the root causes of CBO row count and cost misestimates resulting in plan instability and bad performance.

Understanding CBO inputs SQL text o SQL of views accessed o Columns selected o Predicate conditions o Hints in SQL statements Table, index structure o Table columns, indexed columns and indexed column order o Table/index physical structure (cluster, index-organized table etc) o Partitioning structure and keys Table constraints Optimizer statistics, System statistics Session parameters (optimizer environment) Work area size used (pga_aggregate_target) Understanding CBO outputs What is the Optimizer Cost? How does CBO try to come up with efficient execution plan? Common reasons for CBOs wrong decisions Avoiding underestimating row counts Understanding optimizer s by-design limitations Handling out of range predicate conditions Handling data skew Handling imbalanced filter and join correlations Using dynamic sampling for join-correlation aware statistics Costing PL/SQL functions used in SQL statements Good CBO configuration practices Setting up optimizer for majority of queries Stopping fine-tuning optimizer parameters Good statistics gathering practices How to gather realistic system statistics Where to use histograms and where definitely not to do so Freezing statistics Adjusting statistics Copying statistics 11g improvements Advanced CBO troubleshooting Using the optimizer trace (event 10053) for optimizer problem troubleshooting Troubleshooting heavy cardinality misestimates Troubleshooting cost based query transformation problems