1 How to improve SQL Performance with new Health Check Tool? Carlos Sierra Consulting Technical Advisor © 2012 Oracle Corporation – Proprietary and Confidential.

Slides:



Advertisements
Similar presentations
Sameer Marwa – Infogig Consulting Khaled Yagoub – Oracle Development
Advertisements

1 Proven Process for SQL Tuning Dean Richards Senior DBA, Confio Software.
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.
Copyright © 2013, Oracle and/or its affiliates. 1.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
Module 17 Tracing Access to SQL Server 2008 R2. Module Overview Capturing Activity using SQL Server Profiler Improving Performance with the Database Engine.
Chapter 9 Auditing Database Activities
California State University Common Management Systems TUG Session: April 21, Overview Statistics in CMS PRD / Non-PRD Environments.
Oracle 10g Database Administrator: Implementation and Administration
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Managing and Monitoring SQL Server 2005 Shankar Pal Program Manager SQL Server, Redmond.
1 Tuning PL/SQL procedures using DBMS_PROFILER 20-August 2009 Tim Gorman Evergreen Database Technologies, Inc. Northern California Oracle.
Oracle 11g Real Application Testing: Avoiding Performance Regressions with SQL Performance Analyzer Khaled Yagoub, Pete Belknap, Benoit Dageville, Karl.
DB Audit Expert v1.1 for Oracle Copyright © SoftTree Technologies, Inc. This presentation is for DB Audit Expert for Oracle version 1.1 which.
SQL Server 2005 SP2 Israeli SQL Server User Group March 2005 Ami Levin
Adapted from Afyouni, Database Security and Auditing DB Auditing Examples (Ch. 9) Dr. Mario Guimaraes.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
Overview of SQL Server Alka Arora.
Ihr Logo Data Explorer - A data profiling tool. Your Logo Agenda  Introduction  Existing System  Limitations of Existing System  Proposed Solution.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
ASP.NET Programming with C# and SQL Server First Edition
® IBM Software Group © 2012 IBM Corporation OPTIM Data Studio – Jon Sayles, IBM/Rational November, 2012.
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Chapter 6 Additional Database Objects
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
AWR: Going beyond the scripts supplied by Oracle Jerry Brenner, 5/17/2007.
The Self-Managing Database: Guided Application and SQL Tuning Mohamed Ziauddin Consulting Member of Technical Staff Oracle Corporation Session id:
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
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.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.
SQL Tuning made much easier with SQLTXPLAIN (SQLT) Mauro Pagano Senior Principal Technical Support Engineer Oracle Confidential – Internal/Restricted/Highly.
Chapter 2: SQL – The Basics Objectives: 1.The SQL execution environment 2.SELECT statement 3.SQL Developer & SQL*Plus.
ISV Innovation Presented by ISV Innovation Presented by Business Intelligence Fundamentals: Data Cleansing Ola Ekdahl IT Mentors 9/12/08.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
A Brief Documentation.  Provides basic information about connection, server, and client.
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.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 9 Auditing Database Activities.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Analysing Indexes SQLBits 6 th October 2007 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007.
Dionex Corporation Designs, manufactures and sells chemical analysis equipment Based in Sunnyvale, California Employs more than 1,200 people worldwide.
10g Tuning Highlights Presenter JEREMY SCHNEIDER Senior Consultant, ITC Technology Services.
Batch Jobs Using the batch job functions. Use [Bulk Changes][Batch Job Utility] to start. Read the information panel. Check with TAMS Technical Support.
DB Tuning : Chapter 10. Optimizer Center for E-Business Technology Seoul National University Seoul, Korea 이상근 Intelligent Database Systems Lab School of.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
8 Copyright © 2005, Oracle. All rights reserved. Gathering Statistics.
DB Index Expert Copyright © SoftTree Technologies, Inc.
SQL Server Statistics DEMO SQL Server Statistics SREENI JULAKANTI,MCTS.MCITP SQL SERVER Database Administration.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
2 Copyright © 2008, Oracle. All rights reserved. Building the Physical Layer of a Repository.
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
SQL Server Statistics and its relationship with Query Optimizer
ASE Optdiag Features including dynamic_histogram
SQL Trace and TKPROF.
How To Pass Oracle 1z0-060 Exam In First Attempt?
EVOLUTION OF THE ORACLE OPTIMIZER THINKING
SQL Server Monitoring Overview
Now where does THAT estimate come from?
Cardinality Estimator 2014/2016
Statistics: What are they and How do I use them
The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited)
8 6 MySQL Special Topics A Guide to MySQL.
Managing Performance by SQL Tuning
Recommending Materialized Views and Indexes with the IBM DB2 Design Advisor (Automating Physical Database Design) Jarek Gryz.
Presentation transcript:

1 How to improve SQL Performance with new Health Check Tool? Carlos Sierra Consulting Technical Advisor © 2012 Oracle Corporation – Proprietary and Confidential

2 Topics What, Why, When and How? Health Checks performed What is the output? Output sample Demo Q&A © 2012 Oracle Corporation – Proprietary and Confidential

3 What is the SQL Health Check Tool? Small tool developed by the Server Technologies (ST) Center of Expertise (CoE) Stand-alone SQL script SQL Health Check (HC) does not install schema objects Centric to one SQL statement per use Requires to be executed connecting as SYS (or DBA) Inputs one SQL_ID Outputs HTML report with results of several Health Checks and some additional information © 2012 Oracle Corporation – Proprietary and Confidential

4 Why would I want to use the SQL HC? Easy way to verify environment around one SQL Does not pollute the application nor the database Executes in a few minutes Minimum resources utilization Documents “state” around one SQL Safe to use on queries or DML statements Acting upon output of relevant Health Checks may improve execution plan thus performance Output is small and easy to digest Does not require advanced SQL Tuning expertise © 2012 Oracle Corporation – Proprietary and Confidential

5 When should I use the SQL HC Tool? On a poorly performing SQL as per AWR or StatsPack reports On a SQL statement out of a Trace or TKPROF When a quick sanity check of the environment around one SQL is needed When using SQLTXPLAIN (SQLT) MOS is not a short term option When there had been recent changes on the system and a SQL has regressed in terms of performance When performance of a SQL is not consistent © 2012 Oracle Corporation – Proprietary and Confidential

6 How do I use the SQL HC Tool? Download latest version of sqlhc.sql out of MOS Execute connected as SYS or a user with DBA privileges Parameters Does your site have Oracle Diagnostics or Oracle Tuning Pack licenses? SQL_ID for the SQL statement to be analyzed Review and digest content of HTML output report Act upon those “Observations” reported by HC Some may be more relevant than others in each case © 2012 Oracle Corporation – Proprietary and Confidential

7 Topics What, Why, When and How? Health Checks performed What is the output? Output sample Demo Q&A © 2012 Oracle Corporation – Proprietary and Confidential

8 Health Checks performed Levels Global Table Index Purpose Highlight SQL Tuning opportunities Highlight concerns © 2012 Oracle Corporation – Proprietary and Confidential

9 Global Health Checks Using “STATISTICS_LEVEL = ALL” on LINUX CBO parameters with non-default values optimizer_features_enable <> rdbms_version optimizer_dynamic_sampling between 1 and 3 db_file_multiblock_read_count is set nls_sort is not binary DBMS_STATS automatic gathering High version count Using first rows Fixed objects missing statistics © 2012 Oracle Corporation – Proprietary and Confidential

10 Global Health Checks System statistics not gathered mreadtim < sreadtim sreadtim < 2 mreadtim < 3 sreadtim > 18 mreadtim > 522 SQL with policies as per v$vpd_policy Materialized views with rewrite enabled Table with bitmap index(es) Index in plan no longer exists © 2012 Oracle Corporation – Proprietary and Confidential

11 Global Health Checks SQL Plan Baseline contains non-reproducible Plans Sizes of SQL Plan History and SQL Plan Baseline SQL Profile combined VPD policies Multiple CBO environments INTERNAL_FUNCTION in a Filter Predicate Plan Operations with Cost 0 and Cardinality 1 SREADTIM differs from actual db file sequential read MREADTIM differs from actual db file scattered read © 2012 Oracle Corporation – Proprietary and Confidential

12 Table Health Checks empty_blocks > blocks Table DOP is set Table has indexes with DOP set Index degree <> Table degree No statistics No rows Siebel small tables with statistics Small sample size Old statistics Extended statistics © 2012 Oracle Corporation – Proprietary and Confidential

13 Table Health Checks Columns with no statistics Columns missing low/high values Columns with old statistics More nulls than rows More distinct values than rows Zero distinct values on columns with value Incorrect NDV in long char column with histogram Frequency histograms with less buckets than NDV Frequency histogram with 1 bucket Height balanced histogram with no popular values © 2012 Oracle Corporation – Proprietary and Confidential

14 Table Health Checks ANALYZE command was used Average row length is 100 Tables with stale statistics SQL with policies as per dba_policies SQL with policies as per dba_audit_policies Table partitions with no statistics Table partitions where num rows = 0 Table partitions with outdated statistics Partitions with no column statistics Partition columns with outdated statistics © 2012 Oracle Corporation – Proprietary and Confidential

15 Table Health Checks Derived statistics in Tables or Partitions Table has locked statistics © 2012 Oracle Corporation – Proprietary and Confidential

16 Index Health Checks No statistics More rows in index than its table Clustering factor > rows in table Statistics on zero while columns have value Table/Index statistics out of sync ANALYZE was used No column statistics in single-column index NDV on column > num_rows in single-column index NDV is zero but column has values in single-column index © 2012 Oracle Corporation – Proprietary and Confidential

17 Index Health Checks NDV <> NDK in single-column index Index partitions with no statistics Index partitions where num rows = 0 Index partitions with outdated statistics Derived statistics in Index or Partitions Indexes with UNUSABLE segments INVISIBLE Indexes Index in a Plan with UNUSABLE segments Index in a Plan is now INVISIBLE © 2012 Oracle Corporation – Proprietary and Confidential

18 Topics What, Why, When and How? Health Checks performed What is the output? Output sample Demo Q&A © 2012 Oracle Corporation – Proprietary and Confidential

19 What is the output? Identification Observations (Health Checks results) SQL Text Tables Summary Indexes Summary Current SQL Statistics (GV$SQL) Historical SQL Statistics (DBA_HIST_SQLSTAT) Current Execution Plans (last execution) Current Execution Plans (all executions) Historical Execution Plans © 2012 Oracle Corporation – Proprietary and Confidential

20 What is the output? Tables CBO Statistics Columns CBO Statistics Indexes CBO Statistics © 2012 Oracle Corporation – Proprietary and Confidential

21 Observations section Global then Table then Index All observations include a verbose explanation Some observations have pointers to pertinent MOS documents Some are more relevant than others for your particular SQL Test any change before implementing in Production © 2012 Oracle Corporation – Proprietary and Confidential

22 Tables Summary Content Table level CBO statistics Indexes and Columns counts Columns with Histograms counts Average sample sizes for Indexes and Columns Purpose Quick quantitative view of Tables statistics health Ease a compare between two systems believed to be similar © 2012 Oracle Corporation – Proprietary and Confidential

23 Indexes Summary Content Index level CBO statistics Indication if Index is referenced in an Execution Plan Columns counts Columns with Histograms counts Average sample sizes for Columns Purpose Quick quantitative view of Indexes statistics health Ease a compare between two systems believed to be similar © 2012 Oracle Corporation – Proprietary and Confidential

24 Topics What, Why, When and How? Health Checks performed What is the output? Output sample Demo Q&A © 2012 Oracle Corporation – Proprietary and Confidential

25 Output sample © 2012 Oracle Corporation – Proprietary and Confidential

26 Output sample © 2012 Oracle Corporation – Proprietary and Confidential

27 Output sample © 2012 Oracle Corporation – Proprietary and Confidential

28 References MOS SQL Tuning Health-Check Script MOS SQLTXPLAIN (SQLT) © 2012 Oracle Corporation – Proprietary and Confidential