Oracle Database 11gR2 Optimizer Insights

Size: px
Start display at page:

Download "Oracle Database 11gR2 Optimizer Insights"

Transcription

1 Oracle Database 11gR2 Optimizer Insights Marcus Bender Distinguished Sales Consultant Presales Fellow Strategic Technical Support (STU) ORACLE Deutschland GmbH, Geschäftsstelle Hamburg

2 Parallel Execution & Optimizer Optimizer Optimizer / Cardinality Optimizer / Access Path Optimizer / Join Types Optimizer / Join Order Monitoring Execution SQL Monitor

3 What Happens When a SQL Statement is issue? User SQL Execution 1 2 Oracle Database Syntax Check Semantic Check Parsing 4 Shared Pool check Shared Pool 3 Query Transformation Library Cache Shared SQL Area C1 C2 Cn Plan Generator Code Generator Optimizer Cost Estimator

4 Optimizer Engine Cardinality How to determine what cardinality estimate should be How to combat common causes for incorrect cardinality estimates Access paths How to determine the access path selected Caused for why the wrong access path was selected Join type How to determine what what join type was selected Common causes for why the wrong join type was selected Join order How to determine what join order was selected Common causes for why the wrong join order was selected *

5 Execution Plan SELECT /*+ gather_plan_statistics */ p.prod_name, SUM(s.quantity_sold) FROM sales s, products p WHERE s.prod_id =p.prod_id GROUP By p.prod_name ; SELECT * FROM table ( dbms_xplan.display (null, null. 'ADVANCED')); Slide 1

6 Execution plan - Cardinality Cardinality the estimated # of rows returned by each operation in the plan

7 Execution plan Access Path Access Path Look in Operation section to see how each object is being accessed

8 Access Paths Getting the data Access Path Full table scan Table access by Rowid Index unique scan Index range scan Index skip scan Full index scan Fast full index scan Index joins Bitmap indexes Explanation Reads all rows from table & filters out those that do not meet the where clause predicates. Used when no index, DOP set etc Rowid specifies the datafile & data block containing the row and the location of the row in that block. Used if rowid supplied by index or in where clause Only one row will be returned. Used when stmt contains a UNIQUE or a PRIMARY KEY constraint that guarantees that only a single row is accessed. Accesses adjacent index entries returns ROWID values Used with equality on non-unique indexes or range predicate on unique index (<.>, between etc) Skips the leading edge of the index & uses the rest Advantageous if there are few distinct values in the leading column and many distinct values in the nonleading column Processes all leaf blocks of an index, but only enough branch blocks to find 1 st leaf block. Used when all necessary columns are in index & order by clause matches index struct or if sort merge join is done Scans all blocks in index used to replace a FTS when all necessary columns are in the index. Using multi-block IO & can going parallel Hash join of several indexes that together contain all the table columns that are referenced in the query. Wont eliminate a sort operation uses a bitmap for key values and a mapping function that converts each bit position to a rowid. Can efficiently merge indexes that correspond to several conditions in a WHERE clause Slide 2

9 Execution plan - Join Type Look in the Operation section to check if the correct join type is used

10 Join Types Access Path Nested Loops joins Hash Joins Sort Merge joins Cartesian Joins Outer Joins Explanation For every row in the outer table, Oracle accesses all the rows in the inner table Useful when joining small subsets of data and there is an efficient way to access the second table (index look up) The smaller of two tables is scan and resulting rows are used to build a hash table on the join key in memory. The larger table is then scan, join column of the resulting rows are hashed and the values used to probing the hash table to find the matching rows. Useful for larger tables & if equality pred Consists of two steps: 1. Sort join operation: Both the inputs are sorted on the join key. 2. Merge join operation: The sorted lists are merged together. Useful when the join condition between two tables is an inequality condition Joins every row from one data source with every row from the other data source, creating the Cartesian Product of the two sets. Only good if tables are very small. Only choice if there is no join condition specified in query Returns all rows that satisfy the join condition and also returns all of the rows from the table without the (+) for which no rows from the other table satisfy the join condition

11 Join order Want to start with the table that reduce the result set the most If the join order is not correct, check the statistics, cardinality & access methods

12 Optimizer / Cardinality Oracle 11gR2 Cardinality on the object and on the join level is determined by the optimizer to find the best execution plan For the optimizer that means number of rows returned by an operation The column ROWS in the execution plan or ESTIMATED ROWS in sql monitor shows this information Correct information is crucial for correct execution plans Cardinality feedback (object level): optimizer estimates cardinality actual rows processed are kept in row source tree If estimations are wrong by factor 2 or more they are overwritten

13 Check Cardinality using SQL Monitor

14 Incorrect Cardinality estimates causes Cause No Statistics or Stale Statistics Data Skew Correlated single Table Predicates Multiple correlated Columns used in a Join Function wrapped Column Complicated Expression Slide 3

15 Optimizer Statistics CPU & IO DATA DICTIONARY Optimizer OPTIMIZER STATISTICS Index Table Column System PROMO_PK Index PR_ID PR_NAME PROMO_DATE 1 Promo_1 15-NOV-98 2 Promo_1 31-DEC-98 PROMOTIONS Table GB HJ HJ Execution plan

16 Stale Statistics Statistics are considered stale when 10% or more of the rows in the object have changed Changes include, inserts, updates, deletes etc. Query dictionary to check if statistics are stale SELECT table_name, stale_stats FROM user_tab_ statistics; Table Name Stale_stats Sales NO Customers YES Product -- No means Stats are good Yes means Stats are stale Null means no Stats Solution gather statistics

17 How to Gather Statistics Your gather statistics commands should be this simple Use DBMS_STATS Package

18 How to Gather Statistics Sample Size # 1 most commonly asked question What sample size should I use? Controlled by ESTIMATE_PRECENT parameter From 11g onwards use default value AUTO_SAMPLE_SIZE New hash based algorithm Speed of a 10% sample Accuracy of 100% sample

19 Example of Data Skew SELECT * FROM HR.Employee WHERE Job_id = AD_VP; NAME ENUM JOB Kochhar 101 AD_VP De Haan 102 AD_VP Optimizer assumed even distribution cardinality estimate is NUM_ROW = = NDV 19 HR Employee table Last_name Em_id Job_id SMITH 99 CLERK ALLEN 7499 CLERK WARD 2021 CLERK KOCHHAR 101 AD_VP De Haan 102 AD_VP CLARK 7782 CLERK

20 Solution: Gather Histogram Stats EXEC DBMS_STATS.GATHER_TABLE_STATS( HR, EMPLOYEES,method_opt => FOR ALL COLUMNS SIZE SKEWONLY ); SELECT column_name, num_distinct, histogram FROM user_tab_col_statistics WHERE table_name = EMPLOYEES';

21 What is a frequency histogram? JOB_ID ========== AC_ACCOUNT Bucket 1 has AC_ACCOUNT = 4 AC_VP AD_ASST AD_PRES CLERK Bucket 2 has AD_VP = 2 Bucket 3 has AD_ASST = 3 Bucket 4 has AD_PRES = 11 Bucket 5 has CLERK = FI_ACCOUNT Bucket 19 has FI_ACCOUNT = 8

22 Multiple correlated Columns SELECT... FROM... WHERE model = 530xi AND make = BMW ; Make BMW BMW BMW Model 530xi 530xi 530xi Color RED BLACK SILVER Three records selected Cardinality #ROWS * 1 * 1 NDV c1 NDV c2 Cardinality = 12 * 1:3 * 1:4 = 1 Make Vehicles table Model Color BMW 530xi RED BMW 530xi BLACK BMW 530xi SILVER PORSCHE 911 RED MERC SLK RED MERC C320 SLIVER

23 Solution Create extended statistics on the Model & Make columns exec dbms_stats.gather_table_stats('dwh', 'VEHICLES', degree=>8, method_opt=> 'for columns (MODEL, MAKE) size 256 '); Select column_name, num_distinct, histogram from user_tab_col_statistics where table_name = Vehicles'; New Column with system generated name

24 Solutions for correct cardinality estimates Cause Stale or missing statistics Data Skew Multiple single column predicates on a table Multiple columns used in a join Function wrapped column Complicated expression containing columns from multiple tables Solution DBMS_STATS Create a histogram Create a column group using DBMS_STATS.CREATE_EXTENDED_STATS Create a column group using DBMS_STATS.CREATE_EXTENDED_STATS Create statistics on the function wrapped column using DBMS_STATS.CREATE_EXTENDED_STATS Use dynamic sampling level 4 or higher

25 Optimizer / Cardinality Oracle 12c The optimizer in 12g checks the cardinality during execution Results are buffered before processed NL / HASH Buffer If #rows <= 10 then NL else HASH NL Scan C Scan A Index B

26 Optimizer / Statistics Oracle 12c Dynamic Sampling Optimizer gathers statistics during parse operation alter system set optimizer_dynamic_sampling = 6; Optimizer Dynamic Sampling (no joins): 0 = off 2 = DEFAULT, tables without stats, 32 blocks 3 = level 2 + complex single predicates, 64 blocks 4 = even if table is analyzed, statistics are gathered 5 = level 4, 2x default blocks 6 = level 4, 4 x default blocks PQ 7 = level 4, 8 x default blocks 8 = level 4, 32 x default blocks 9 = level 4, 128 x default blocks 10 = level 4, complete table

27 Simplification & Performance From experience we know that running a statement with the optimal execution plan results in best performance Performance: In 11gR2 cardinality extended statistics, cardinality feedback and improved dynamic sampling enables the optimizer to find the best execution plan Simple: For extended stats a tool is designed that analyzes the workload and recommends all relevant group statistics

28 Parallel Execution & Optimizer Optimizer Optimizer / Cardinality Optimizer / Access Path Optimizer / Join Types Optimizer / Join Order Monitoring Execution SQL Monitor

29

30

31

32

33

34

35 Simplification & Performance Simple: Monitoring execution provides an excellent overview of all running statements on a system including: Execution plan Number of PQ slaves and PQ distribution Top wait events Temp usage Actual rows processed Elapsed time and phase of execution CPU and I/O consumption Performance: Thus enabling a DBA to get easy the best and most detailed information to analyze potential performance problems

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved.

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved. 1 Copyright 2011, Oracle and/or its affiliates. All rights 2 Copyright 2011, Oracle and/or its affiliates. All rights Optimizer Statistics CPU & IO DATA DICTIONARY OPTIMIZER STATISTICS Index Table Column

More information

<Insert Picture Here> Inside the Oracle Database 11g Optimizer Removing the black magic

<Insert Picture Here> Inside the Oracle Database 11g Optimizer Removing the black magic Inside the Oracle Database 11g Optimizer Removing the black magic Hermann Bär Data Warehousing Product Management, Server Technologies Goals of this session We will Provide a common

More information

Explaining the Explain Plan:

Explaining the Explain Plan: Explaining the Explain Plan: Interpre'ng Execu'on Plans for SQL Statements Maria Colgan Master Product Manager June 2017 @SQLMaria Safe Harbor Statement The following is intended to outline our general

More information

<Insert Picture Here> Oracle Database 11g: Neue Features im Oracle Optimizer

<Insert Picture Here> Oracle Database 11g: Neue Features im Oracle Optimizer Oracle Database 11g: Neue Features im Oracle Optimizer Hermann Bär, Oracle Director Product Management, Server Technologies Data Warehousing Inside the Oracle Database 11g Optimizer

More information

The Oracle Optimizer Explain the Explain Plan O R A C L E W H I T E P A P E R A P R I L

The Oracle Optimizer Explain the Explain Plan O R A C L E W H I T E P A P E R A P R I L The Oracle Optimizer Explain the Explain Plan O R A C L E W H I T E P A P E R A P R I L 2 0 1 7 Table of Contents Introduction 1 The Execution Plan 2 Displaying the Execution Plan 3 What is Cost? 7 Understanding

More information

Real-World Performance Training SQL Performance

Real-World Performance Training SQL Performance Real-World Performance Training SQL Performance Real-World Performance Team Agenda 1 2 3 4 5 6 The Optimizer Optimizer Inputs Optimizer Output Advanced Optimizer Behavior Why is my SQL slow? Optimizer

More information

Real-World Performance Training SQL Performance

Real-World Performance Training SQL Performance Real-World Performance Training SQL Performance Real-World Performance Team Agenda 1 2 3 4 5 6 SQL and the Optimizer You As The Optimizer Optimization Strategies Why is my SQL slow? Optimizer Edges Cases

More information

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

D B M G Data Base and Data Mining Group of Politecnico di Torino Database Management Data Base and Data Mining Group of tania.cerquitelli@polito.it A.A. 2014-2015 Optimizer operations Operation Evaluation of expressions and conditions Statement transformation Description

More information

Oracle 11g Db Stats Enhancements Inderpal S. Johal. Inderpal S. Johal, Data Softech Inc.

Oracle 11g Db Stats Enhancements   Inderpal S. Johal. Inderpal S. Johal, Data Softech Inc. ORACLE 11G DATABASE STATISTICS MULTICOLUMN STATISTICS Inderpal S. Johal, Data Softech Inc. OVERVIEW Prior to Oracle 11g, optimizer utilizes the statistics of all the columns involved in Complex predicate

More information

Answer: Reduce the amount of work Oracle needs to do to return the desired result.

Answer: Reduce the amount of work Oracle needs to do to return the desired result. SQL Tuning 101 excerpt: Explain Plan A Logical Approach By mruckdaschel@affiniongroup.com Michael Ruckdaschel Affinion Group International My Qualifications Software Developer for Affinion Group International

More information

Cost Based Optimizer CBO: Configuration Roadmap

Cost Based Optimizer CBO: Configuration Roadmap Cost Based Optimizer CBO: Configuration Roadmap Christian Antognini Sandro Crepaldi DOAG Regionaltreffen Hamburg/Nord 13.09.05, Hamburg Disclaimer > The CBO changes from release to release > It s difficult

More information

Optimizer with Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R J U N E

Optimizer with Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R J U N E Optimizer with Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R J U N E 2 0 1 7 Table of Contents Introduction 1 Adaptive Query Optimization 2 Optimizer Statistics 13 Optimizer Statistics

More information

Oracle Optimizer: What s New in Oracle Database 12c? Maria Colgan Master Product Manager

Oracle Optimizer: What s New in Oracle Database 12c? Maria Colgan Master Product Manager Oracle Optimizer: What s New in Oracle Database 12c? Maria Colgan Master Product Manager PART 3 2 Program Agenda Adaptive Query Optimization Statistics Enhancements What s new in SQL Plan Management 3

More information

Query Optimization, part 2: query plans in practice

Query Optimization, part 2: query plans in practice Query Optimization, part 2: query plans in practice CS634 Lecture 13 Slides by E. O Neil based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Working with the Oracle query optimizer First

More information

20 Essential Oracle SQL and PL/SQL Tuning Tips. John Mullins

20 Essential Oracle SQL and PL/SQL Tuning Tips. John Mullins 20 Essential Oracle SQL and PL/SQL Tuning Tips John Mullins jmullins@themisinc.com www.themisinc.com www.themisinc.com/webinars Presenter John Mullins Themis Inc. (jmullins@themisinc.com) 30+ years of

More information

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Copyright 2012, Oracle and/or its affiliates. All rights reserved. 1 Oracle safe harbor statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not

More information

Effect of Stats on Two Columns Optimizer Statistics on tables and indexes are vital. Arup Nanda

Effect of Stats on Two Columns Optimizer Statistics on tables and indexes are vital. Arup Nanda Stats with Intelligence Arup Nanda Longtime Oracle DBA Effect of Stats on Two Columns Optimizer Statistics on tables and indexes are vital for the optimizer to compute optimal execution plans If there

More information

SQL Gone Wild: Taming Bad SQL the Easy Way (or the Hard Way) Sergey Koltakov Product Manager, Database Manageability

SQL Gone Wild: Taming Bad SQL the Easy Way (or the Hard Way) Sergey Koltakov Product Manager, Database Manageability SQL Gone Wild: Taming Bad SQL the Easy Way (or the Hard Way) Sergey Koltakov Product Manager, Database Manageability Oracle Enterprise Manager Top-Down, Integrated Application Management Complete, Open,

More information

Exploring Best Practices and Guidelines for Tuning SQL Statements

Exploring Best Practices and Guidelines for Tuning SQL Statements Exploring Best Practices and Guidelines for Tuning SQL Statements Ami Aharonovich Oracle ACE & OCP Ami@DBAces.co.il Oracle ACE Who am I Oracle Certified Professional DBA (OCP) Founder and CEO, DBAces Oracle

More information

Ensuring Optimal Performance. Vivek Sharma. 3 rd November 2012 Sangam 2012

Ensuring Optimal Performance. Vivek Sharma. 3 rd November 2012 Sangam 2012 Ensuring Optimal Performance Vivek Sharma 3 rd November 2012 Sangam 2012 Who am I? Around 12 Years using Oracle Products Certified DBA versions 8i Specializes in Performance Optimization COE Lead with

More information

Oracle SQL Tuning for Developers Workshop Student Guide - Volume I

Oracle SQL Tuning for Developers Workshop Student Guide - Volume I Oracle SQL Tuning for Developers Workshop Student Guide - Volume I D73549GC10 Edition 1.0 October 2012 D78799 Authors Sean Kim Dimpi Rani Sarmah Technical Contributors and Reviewers Nancy Greenberg Swarnapriya

More information

An Oracle White Paper April Best Practices for Gathering Optimizer Statistics

An Oracle White Paper April Best Practices for Gathering Optimizer Statistics An Oracle White Paper April 2012 Best Practices for Gathering Optimizer Statistics Introduction... 2 How to gather statistics... 3 Automatic statistics gathering job... 3 Manually statistics collection...

More information

Interpreting Explain Plan Output. John Mullins

Interpreting Explain Plan Output. John Mullins Interpreting Explain Plan Output John Mullins jmullins@themisinc.com www.themisinc.com www.themisinc.com/webinars Presenter John Mullins Themis Inc. (jmullins@themisinc.com) 30+ years of Oracle experience

More information

Die Wundertüte DBMS_STATS: Überraschungen in der Praxis

Die Wundertüte DBMS_STATS: Überraschungen in der Praxis Die Wundertüte DBMS_STATS: Überraschungen in der Praxis, 14. Mai 2018 Dani Schnider, Trivadis AG @dani_schnider danischnider.wordpress.com BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA

More information

Top 10 Features in Oracle 12C for Developers and DBA s Gary Bhandarkar Merck & Co., Inc., Rahway, NJ USA

Top 10 Features in Oracle 12C for Developers and DBA s Gary Bhandarkar Merck & Co., Inc., Rahway, NJ USA Top 10 Features in Oracle 12C for Developers and DBA s Gary Bhandarkar Merck & Co., Inc., Rahway, NJ USA Agenda Background ORACLE 12c FEATURES CONCLUSION 2 Top 10 Oracle 12c Features Feature 1: ADAPTIVE

More information

Pitfalls & Surprises with DBMS_STATS: How to Solve Them

Pitfalls & Surprises with DBMS_STATS: How to Solve Them Pitfalls & Surprises with DBMS_STATS: How to Solve Them Dani Schnider, Trivadis AG @dani_schnider danischnider.wordpress.com BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN

More information

Oracle DB-Tuning Essentials

Oracle DB-Tuning Essentials Infrastructure at your Service. Oracle DB-Tuning Essentials Agenda 1. The DB server and the tuning environment 2. Objective, Tuning versus Troubleshooting, Cost Based Optimizer 3. Object statistics 4.

More information

Query Optimizer, Who Influences & How it works ++ optimization techniques

Query Optimizer, Who Influences & How it works ++ optimization techniques Query Optimizer, Who Influences & How it works ++ optimization techniques AIOUG : ODevC Yatra 2018, India Chandan Tanwani Senior Application Engineer Oracle Financial Services Software Ltd. Copyright 2018

More information

Triangle SQL Server User Group Adaptive Query Processing with Azure SQL DB and SQL Server 2017

Triangle SQL Server User Group Adaptive Query Processing with Azure SQL DB and SQL Server 2017 Triangle SQL Server User Group Adaptive Query Processing with Azure SQL DB and SQL Server 2017 Joe Sack, Principal Program Manager, Microsoft Joe.Sack@Microsoft.com Adaptability Adapt based on customer

More information

Oracle Sql Tuning- A Framework

Oracle Sql Tuning- A Framework Oracle Sql Tuning- A Framework Prepared by Saurabh Kumar Mishra Performance Engineering & Enhancement offerings (PE2) Infosys Technologies Limited (NASDAQ: INFY) saurabhkumar_mishra@infosys.com This paper

More information

Oracle Database 11g: SQL Tuning Workshop

Oracle Database 11g: SQL Tuning Workshop Oracle University Contact Us: Local: 0845 777 7 711 Intl: +44 845 777 7 711 Oracle Database 11g: SQL Tuning Workshop Duration: 3 Days What you will learn This Oracle Database 11g: SQL Tuning Workshop Release

More information

Infrastructure at your Service. In-Memory-Pläne für den 12.2-Optimizer: Teuer oder billig?

Infrastructure at your Service. In-Memory-Pläne für den 12.2-Optimizer: Teuer oder billig? Infrastructure at your Service. In-Memory-Pläne für den 12.2-Optimizer: Teuer oder billig? About me Infrastructure at your Service. Clemens Bleile Senior Consultant Oracle Certified Professional DB 11g,

More information

Top 7 Plan Stability Pitfalls & How to Avoid Them. Neil Chandler Chandler Systems Ltd UK

Top 7 Plan Stability Pitfalls & How to Avoid Them. Neil Chandler Chandler Systems Ltd UK Top 7 Plan Stability Pitfalls & How to Avoid Them Neil Chandler Chandler Systems Ltd UK Keywords: SQL Optimizer Plan Change Stability Outlines Baselines Plan Directives Introduction When you write some

More information

Join (SQL) - Wikipedia, the free encyclopedia

Join (SQL) - Wikipedia, the free encyclopedia 페이지 1 / 7 Sample tables All subsequent explanations on join types in this article make use of the following two tables. The rows in these tables serve to illustrate the effect of different types of joins

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 19 Query Optimization Introduction Query optimization Conducted by a query optimizer in a DBMS Goal: select best available strategy for executing query Based on information available Most RDBMSs

More information

Oracle Database 12c: SQL Tuning for Developers

Oracle Database 12c: SQL Tuning for Developers Oracle Database 12c: SQL Tuning for Developers Student Guide Volume I D79995GC10 Edition 1.0 December 2016 D84109 Learn more from Oracle University at education.oracle.com Author Dimpi Rani Sarmah Technical

More information

Oracle Database 11g: SQL Tuning Workshop. Student Guide

Oracle Database 11g: SQL Tuning Workshop. Student Guide Oracle Database 11g: SQL Tuning Workshop Student Guide D52163GC10 Edition 1.0 June 2008 Author Jean-François Verrier Technical Contributors and Reviewers Muriel Fry (Special thanks) Joel Goodman Harald

More information

Tuning with Statistics

Tuning with Statistics Tuning with Statistics Wolfgang Breitling breitliw@centrexcc.com Agenda The DBMS_STATS Package Uses of DBMS_STATS beyond analyze The stattab Table Transferring Statistics with the stattab Table Means to

More information

Understanding Optimizer Statistics With Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R M A R C H

Understanding Optimizer Statistics With Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R M A R C H Understanding Optimizer Statistics With Oracle Database 12c Release 2 O R A C L E W H I T E P A P E R M A R C H 2 0 1 7 Table of Contents Introduction 1 What are Optimizer Statistics? 2 Statistics on Partitioned

More information

Database statistics gathering: Synopsis

Database statistics gathering: Synopsis Database statistics gathering: Synopsis Introduction It is known that having proper database statistics is crucial for query optimizer. Statistics should properly describe data within the database. To

More information

THE DBMS_STATS PACKAGE

THE DBMS_STATS PACKAGE SQL TUNING WITH STATISTICS Wolfgang Breitling, Centrex Consulting Corporation This paper looks at the DBMS_STATS package and how it can be used beyond just the gathering of statistics in the tuning effort,

More information

Query Optimizer MySQL vs. PostgreSQL

Query Optimizer MySQL vs. PostgreSQL Percona Live, Frankfurt (DE), 7 November 2018 Christian Antognini @ChrisAntognini antognini.ch/blog BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART

More information

7. Query Processing and Optimization

7. Query Processing and Optimization 7. Query Processing and Optimization Processing a Query 103 Indexing for Performance Simple (individual) index B + -tree index Matching index scan vs nonmatching index scan Unique index one entry and one

More information

.. Spring 2008 CSC 468: DBMS Implementation Alexander Dekhtyar..

.. Spring 2008 CSC 468: DBMS Implementation Alexander Dekhtyar.. .. Spring 2008 CSC 468: DBMS Implementation Alexander Dekhtyar.. Tuning Oracle Query Execution Performance The performance of SQL queries in Oracle can be modified in a number of ways: By selecting a specific

More information

<Insert Picture Here> DBA s New Best Friend: Advanced SQL Tuning Features of Oracle Database 11g

<Insert Picture Here> DBA s New Best Friend: Advanced SQL Tuning Features of Oracle Database 11g DBA s New Best Friend: Advanced SQL Tuning Features of Oracle Database 11g Peter Belknap, Sergey Koltakov, Jack Raitto The following is intended to outline our general product direction.

More information

Query Optimizer MySQL vs. PostgreSQL

Query Optimizer MySQL vs. PostgreSQL Percona Live, Santa Clara (USA), 24 April 2018 Christian Antognini @ChrisAntognini antognini.ch/blog BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN LAUSANNE MUNICH

More information

Outline. Database Management and Tuning. Outline. Join Strategies Running Example. Index Tuning. Johann Gamper. Unit 6 April 12, 2012

Outline. Database Management and Tuning. Outline. Join Strategies Running Example. Index Tuning. Johann Gamper. Unit 6 April 12, 2012 Outline Database Management and Tuning Johann Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE Unit 6 April 12, 2012 1 Acknowledgements: The slides are provided by Nikolaus Augsten

More information

Estimating Cardinality: Use of Jonathan Lewis CBO methodology

Estimating Cardinality: Use of Jonathan Lewis CBO methodology Estimating Cardinality: Use of Jonathan Lewis CBO methodology Dave Abercrombie Principal Database Architect, Convio NoCOUG Fall Conference 2010 1 2009 Convio, Inc. Cost-Based Oracle Fundamentals By Jonathan

More information

DSS Performance in Oracle Database 10g. An Oracle White Paper September 2003

DSS Performance in Oracle Database 10g. An Oracle White Paper September 2003 DSS Performance in Oracle Database 10g An Oracle White Paper September 2003 DSS Performance in Oracle Database 10g Executive Overview... 3 Introduction... 3 Test Environment... 4 Performance and Feature

More information

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 6 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA

More information

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe Introduction to Query Processing and Query Optimization Techniques Outline Translating SQL Queries into Relational Algebra Algorithms for External Sorting Algorithms for SELECT and JOIN Operations Algorithms

More information

Firebird in 2011/2012: Development Review

Firebird in 2011/2012: Development Review Firebird in 2011/2012: Development Review Dmitry Yemanov mailto:dimitr@firebirdsql.org Firebird Project http://www.firebirdsql.org/ Packages Released in 2011 Firebird 2.1.4 March 2011 96 bugs fixed 4 improvements,

More information

ORACLE TRAINING CURRICULUM. Relational Databases and Relational Database Management Systems

ORACLE TRAINING CURRICULUM. Relational Databases and Relational Database Management Systems ORACLE TRAINING CURRICULUM Relational Database Fundamentals Overview of Relational Database Concepts Relational Databases and Relational Database Management Systems Normalization Oracle Introduction to

More information

optimization process (see Optimization process, CBO) RBO, 25 Cursor cache, 41, 42 child, 42 parent, 42

optimization process (see Optimization process, CBO) RBO, 25 Cursor cache, 41, 42 child, 42 parent, 42 Index A Access methods bitmap index access CONVERSION COUNT example, 251 INDEX COMBINE, INLIST, 252 manipulation operations, 249 operations, 248, 250 251 physical structure, 247 restricted ROWIDs, 248

More information

Teradata. This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries.

Teradata. This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries. Teradata This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries. What is it? Teradata is a powerful Big Data tool that can be used in order to quickly

More information

MANAGING COST-BASED OPTIMIZER STATISTICS FOR PEOPLESOFT DAVID KURTZ UKOUG PEOPLESOFT ROADSHOW 2018

MANAGING COST-BASED OPTIMIZER STATISTICS FOR PEOPLESOFT DAVID KURTZ UKOUG PEOPLESOFT ROADSHOW 2018 MANAGING COST-BASED OPTIMIZER STATISTICS FOR PEOPLESOFT DAVID KURTZ UKOUG PEOPLESOFT ROADSHOW 2018 WHO AM I Accenture Enkitec Group Performance tuning PeopleSoft ERP Oracle RDBMS Book www.go-faster.co.uk

More information

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH Institute of Aga 2018 Microsoft SQL Server LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece

More information

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH 2017 Institute of Aga Network Database LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece of

More information

Relational Database Index Design and the Optimizers

Relational Database Index Design and the Optimizers Relational Database Index Design and the Optimizers DB2, Oracle, SQL Server, et al. Tapio Lahdenmäki Michael Leach (C^WILEY- IX/INTERSCIENCE A JOHN WILEY & SONS, INC., PUBLICATION Contents Preface xv 1

More information

Five Things You Might Not Know About Oracle Database

Five Things You Might Not Know About Oracle Database Five Things You Might Not Know About Oracle Database Maria Colgan Oracle Database Product Management February 2018 @SQLMaria Safe Harbor Statement The following is intended to outline our general product

More information

Parallel Execution Plans

Parallel Execution Plans Parallel Execution Plans jonathanlewis.wordpress.com www.jlcomp.demon.co.uk My History Independent Consultant 33+ years in IT 28+ using Oracle (5.1a on MSDOS 3.3 Strategy, Design, Review, Briefings, Educational,

More information

Improving Database Performance: SQL Query Optimization

Improving Database Performance: SQL Query Optimization CHAPTER 21 Improving Database Performance: SQL Query Optimization Performance tuning is the one area in which the Oracle DBA probably spends most of his or her time. If you re a DBA helping developers

More information

Oracle. Exam Questions 1Z Oracle Database 11g Release 2: SQL Tuning Exam. Version:Demo

Oracle. Exam Questions 1Z Oracle Database 11g Release 2: SQL Tuning Exam. Version:Demo Oracle Exam Questions 1Z0-117 Oracle Database 11g Release 2: SQL Tuning Exam Version:Demo 1.You ran a high load SQL statement that used an index through the SQL Tuning Advisor and accepted its recommendation

More information

Querying Data with Transact SQL

Querying Data with Transact SQL Course 20761A: Querying Data with Transact SQL Course details Course Outline Module 1: Introduction to Microsoft SQL Server 2016 This module introduces SQL Server, the versions of SQL Server, including

More information

Adaptive Optimization. Presented by: Kerry Osborne Red Gate Webinar, Nov. 2013

Adaptive Optimization. Presented by: Kerry Osborne Red Gate Webinar, Nov. 2013 Adaptive Optimization Presented by: Kerry Osborne Red Gate Webinar, Nov. 2013 whoami Never Worked for Oracle Worked with Oracle DB Since 1982 (V2) Working with Exadata since early 2010 Work for Enkitec

More information

Using the Set Operators. Copyright 2006, Oracle. All rights reserved.

Using the Set Operators. Copyright 2006, Oracle. All rights reserved. Using the Set Operators Objectives After completing this lesson, you should be able to do the following: Describe set operators Use a set operator to combine multiple queries into a single query Control

More information

Oracle Database Performance Tuning, Benchmarks & Replication

Oracle Database Performance Tuning, Benchmarks & Replication Oracle Database Performance Tuning, Benchmarks & Replication Kapil Malhotra kapil.malhotra@software.dell.com Solutions Architect, Information Management Dell Software 2 11/29/2013 Software Database Tuning

More information

Slide 2 of 79 12/03/2011

Slide 2 of 79 12/03/2011 Doug Burns Introduction Simple Fundamentals Statistics on Partitioned Objects The Quality/Performance Trade-off Aggregation Scenarios Alternative Strategies Incremental Statistics Conclusions and References

More information

Wolfgang Breitling.

Wolfgang Breitling. Wolfgang Breitling (breitliw@centrexcc.com) 2 a) cost card operation ------- -------- -------------------------------------------------------------- 2,979 446 SELECT STATEMENT 2,979 446 SORT ORDER BY FILTER

More information

Upgrading from Oracle Database 9i to 10g: What to expect from the Optimizer. An Oracle White Paper July 2008

Upgrading from Oracle Database 9i to 10g: What to expect from the Optimizer. An Oracle White Paper July 2008 Upgrading from Oracle Database 9i to 10g: What to expect from the Optimizer An Oracle White Paper July 2008 NOTE: The following is intended to outline our general product direction. It is intended for

More information

Scaling To Infinity: Making Star Transformations Sing. Thursday 15-November 2012 Tim Gorman

Scaling To Infinity: Making Star Transformations Sing. Thursday 15-November 2012 Tim Gorman Scaling To Infinity: Making Star Transformations Sing Thursday 15-November 2012 Tim Gorman www.evdbt.com Speaker Qualifications Co-author 1. Oracle8 Data Warehousing, 1998 John Wiley & Sons 2. Essential

More information

Oracle Hints. Using Optimizer Hints

Oracle Hints. Using Optimizer Hints Politecnico di Torino Tecnologia delle Basi di Dati Oracle Hints Computer Engineering, 2009-2010, slides by Tania Cerquitelli and Daniele Apiletti Using Optimizer Hints You can use comments in a SQL statement

More information

Announcement. Reading Material. Overview of Query Evaluation. Overview of Query Evaluation. Overview of Query Evaluation 9/26/17

Announcement. Reading Material. Overview of Query Evaluation. Overview of Query Evaluation. Overview of Query Evaluation 9/26/17 Announcement CompSci 516 Database Systems Lecture 10 Query Evaluation and Join Algorithms Project proposal pdf due on sakai by 5 pm, tomorrow, Thursday 09/27 One per group by any member Instructor: Sudeepa

More information

Chapter 12: Query Processing

Chapter 12: Query Processing Chapter 12: Query Processing Overview Catalog Information for Cost Estimation $ Measures of Query Cost Selection Operation Sorting Join Operation Other Operations Evaluation of Expressions Transformation

More information

SQLSaturday Sioux Falls, SD Hosted by (605) SQL

SQLSaturday Sioux Falls, SD Hosted by (605) SQL SQLSaturday 2017 Sioux Falls, SD Hosted by (605) SQL Please be sure to visit the sponsors during breaks and enter their end-of-day raffles! Remember to complete session surveys! You will be emailed a link

More information

THE COST BASED OPTIMIZER

THE COST BASED OPTIMIZER FALLACIES OF THE COST BASED OPTIMIZER Wolfgang Breitling, Centrex Consulting Corporation The essential task of the optimizer is to identify an execution plan among many possible plans that is least costly.

More information

Session id: The Self-Managing Database: Guided Application and SQL Tuning

Session id: The Self-Managing Database: Guided Application and SQL Tuning Session id: 40713 The Self-Managing Database: Guided Application and SQL Tuning Lead Architects Benoit Dageville Khaled Yagoub Mohamed Zait Mohamed Ziauddin Agenda SQL Tuning Challenges Automatic SQL Tuning

More information

Relational Database Index Design and the Optimizers

Relational Database Index Design and the Optimizers Relational Database Index Design and the Optimizers DB2, Oracle, SQL Server, et al. Tapio Lahdenmäki Michael Leach A JOHN WILEY & SONS, INC., PUBLICATION Relational Database Index Design and the Optimizers

More information

Query optimization. Elena Baralis, Silvia Chiusano Politecnico di Torino. DBMS Architecture D B M G. Database Management Systems. Pag.

Query optimization. Elena Baralis, Silvia Chiusano Politecnico di Torino. DBMS Architecture D B M G. Database Management Systems. Pag. Database Management Systems DBMS Architecture SQL INSTRUCTION OPTIMIZER MANAGEMENT OF ACCESS METHODS CONCURRENCY CONTROL BUFFER MANAGER RELIABILITY MANAGEMENT Index Files Data Files System Catalog DATABASE

More information

Algorithms for Query Processing and Optimization. 0. Introduction to Query Processing (1)

Algorithms for Query Processing and Optimization. 0. Introduction to Query Processing (1) Chapter 19 Algorithms for Query Processing and Optimization 0. Introduction to Query Processing (1) Query optimization: The process of choosing a suitable execution strategy for processing a query. Two

More information

Review. Relational Query Optimization. Query Optimization Overview (cont) Query Optimization Overview. Cost-based Query Sub-System

Review. Relational Query Optimization. Query Optimization Overview (cont) Query Optimization Overview. Cost-based Query Sub-System Review Relational Query Optimization R & G Chapter 12/15 Implementation of single Relational Operations Choices depend on indexes, memory, stats, Joins Blocked nested loops: simple, exploits extra memory

More information

QUERY OPTIMIZATION [CH 15]

QUERY OPTIMIZATION [CH 15] Spring 2017 QUERY OPTIMIZATION [CH 15] 4/12/17 CS 564: Database Management Systems; (c) Jignesh M. Patel, 2013 1 Example SELECT distinct ename FROM Emp E, Dept D WHERE E.did = D.did and D.dname = Toy EMP

More information

Query Evaluation Overview, cont.

Query Evaluation Overview, cont. Query Evaluation Overview, cont. Lecture 9 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Architecture of a DBMS Query Compiler Execution Engine Index/File/Record Manager

More information

DumpsKing. Latest exam dumps & reliable dumps VCE & valid certification king

DumpsKing.   Latest exam dumps & reliable dumps VCE & valid certification king DumpsKing http://www.dumpsking.com Latest exam dumps & reliable dumps VCE & valid certification king Exam : 1z1-062 Title : Oracle Database 12c: Installation and Administration Vendor : Oracle Version

More information

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Foundations. 6-4 Data Manipulation Language (DML) Copyright 2015, Oracle and/or its affiliates. All rights reserved. Database Foundations 6-4 Roadmap You are here Introduction to Oracle Application Express Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) Transaction Control

More information

Oracle Database: Introduction to SQL Ed 2

Oracle Database: Introduction to SQL Ed 2 Oracle University Contact Us: +40 21 3678820 Oracle Database: Introduction to SQL Ed 2 Duration: 5 Days What you will learn This Oracle Database 12c: Introduction to SQL training helps you write subqueries,

More information

1z0-062.exam.215q 1z0-062 Oracle Database 12c: Installation and Administration

1z0-062.exam.215q 1z0-062 Oracle Database 12c: Installation and Administration 1z0-062.exam.215q Number: 1z0-062 Passing Score: 800 Time Limit: 120 min 1z0-062 Oracle Database 12c: Installation and Administration Exam A QUESTION 1 You notice a high number of waits for the db file

More information

Datenbanksysteme II: Caching and File Structures. Ulf Leser

Datenbanksysteme II: Caching and File Structures. Ulf Leser Datenbanksysteme II: Caching and File Structures Ulf Leser Content of this Lecture Caching Overview Accessing data Cache replacement strategies Prefetching File structure Index Files Ulf Leser: Implementation

More information

Adaptive

Adaptive Christian Antognini @ChrisAntognini antognini.ch/blog BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURICH @ChrisAntognini Senior

More information

Relational Query Optimization. Overview of Query Evaluation. SQL Refresher. Yanlei Diao UMass Amherst October 23 & 25, 2007

Relational Query Optimization. Overview of Query Evaluation. SQL Refresher. Yanlei Diao UMass Amherst October 23 & 25, 2007 Relational Query Optimization Yanlei Diao UMass Amherst October 23 & 25, 2007 Slide Content Courtesy of R. Ramakrishnan, J. Gehrke, and J. Hellerstein 1 Overview of Query Evaluation Query Evaluation Plan:

More information

Chapter 3. Algorithms for Query Processing and Optimization

Chapter 3. Algorithms for Query Processing and Optimization Chapter 3 Algorithms for Query Processing and Optimization Chapter Outline 1. Introduction to Query Processing 2. Translating SQL Queries into Relational Algebra 3. Algorithms for External Sorting 4. Algorithms

More information

tablename ORDER BY column ASC tablename ORDER BY column DESC sortingorder, } The WHERE and ORDER BY clauses can be combined in one

tablename ORDER BY column ASC tablename ORDER BY column DESC sortingorder, } The WHERE and ORDER BY clauses can be combined in one } The result of a query can be sorted in ascending or descending order using the optional ORDER BY clause. The simplest form of an ORDER BY clause is SELECT columnname1, columnname2, FROM tablename ORDER

More information

QUERY OPTIMIZATION E Jayant Haritsa Computer Science and Automation Indian Institute of Science. JAN 2014 Slide 1 QUERY OPTIMIZATION

QUERY OPTIMIZATION E Jayant Haritsa Computer Science and Automation Indian Institute of Science. JAN 2014 Slide 1 QUERY OPTIMIZATION E0 261 Jayant Haritsa Computer Science and Automation Indian Institute of Science JAN 2014 Slide 1 Database Engines Main Components Query Processing Transaction Processing Access Methods JAN 2014 Slide

More information

Neil Chandler, Chandler Systems Oracle & SQL Server DBA

Neil Chandler, Chandler Systems Oracle & SQL Server DBA Neil Chandler, Chandler Systems Oracle & SQL Server DBA In IT since 1988 Working with Oracle since about 1991 Chairman of the UKOUG RAC, Cloud, Infrastructure and Availability SIG BLOG: http://chandlerdba.wordpress.com/

More information

Query Processing and Query Optimization. Prof Monika Shah

Query Processing and Query Optimization. Prof Monika Shah Query Processing and Query Optimization Query Processing SQL Query Is in Library Cache? System catalog (Dict / Dict cache) Scan and verify relations Parse into parse tree (relational Calculus) View definitions

More information

When should an index be used?

When should an index be used? When should an index be used? Christian Antognini Trivadis AG Zürich, Switzerland Introduction One of the biggest problems tuning a SQL statement or judging if its execution plan is optimal, is to decide

More information

Database Systems External Sorting and Query Optimization. A.R. Hurson 323 CS Building

Database Systems External Sorting and Query Optimization. A.R. Hurson 323 CS Building External Sorting and Query Optimization A.R. Hurson 323 CS Building External sorting When data to be sorted cannot fit into available main memory, external sorting algorithm must be applied. Naturally,

More information

Oracle Syllabus Course code-r10605 SQL

Oracle Syllabus Course code-r10605 SQL Oracle Syllabus Course code-r10605 SQL Writing Basic SQL SELECT Statements Basic SELECT Statement Selecting All Columns Selecting Specific Columns Writing SQL Statements Column Heading Defaults Arithmetic

More information

Tuning Considerations for Different Applications Lesson 4

Tuning Considerations for Different Applications Lesson 4 4 Tuning Considerations for Different Applications Lesson 4 Objectives After completing this lesson, you should be able to do the following: Use the available data access methods to tune the logical design

More information

What happens. 376a. Database Design. Execution strategy. Query conversion. Next. Two types of techniques

What happens. 376a. Database Design. Execution strategy. Query conversion. Next. Two types of techniques 376a. Database Design Dept. of Computer Science Vassar College http://www.cs.vassar.edu/~cs376 Class 16 Query optimization What happens Database is given a query Query is scanned - scanner creates a list

More information