Optimizing Your Database Performance the Easy Way



Similar documents
PATROL From a Database Administrator s Perspective

Oracle Database 12c: Performance Management and Tuning NEW

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

Improve SQL Performance with BMC Software

Module 15: Monitoring

EZManage SQL Pro. Quick guide for installation and implementation

The Ultimate Remote Database Administration Tool for Oracle, SQL Server and DB2 UDB

CA Database Performance

Comparison of DBI Products and BMC SmartDBA

How To Use Ibm Tivoli Monitoring Software

Facilitating Efficient Data Management by Craig S. Mullins

White Paper. The Ten Features Your Web Application Monitoring Software Must Have. Executive Summary

PERFORMANCE TUNING FOR PEOPLESOFT APPLICATIONS

High Speed Transaction Recovery By Craig S. Mullins

The day-to-day of the IT department. What is Panda Cloud Systems Management? Benefits of Panda Cloud Systems Management

Oracle Database 11g: Performance Tuning DBA Release 2

Capacity Planning Use Case: Mobile SMS How one mobile operator uses BMC Capacity Management to avoid problems with a major revenue stream

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

WAIT-TIME ANALYSIS METHOD: NEW BEST PRACTICE FOR APPLICATION PERFORMANCE MANAGEMENT

Transaction Performance Maximizer InterMax

One of the database administrators

ORACLE DATABASE 10G ENTERPRISE EDITION

Unicenter Database Management For Distributed RDBMS

Monitoring and Diagnosing Production Applications Using Oracle Application Diagnostics for Java. An Oracle White Paper December 2007

Response Time Analysis

SQL Server Query Tuning

Oracle Database 11g: SQL Tuning Workshop Release 2

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

SQL Server 2012 Performance White Paper

Oracle Database 12c: Performance Management and Tuning NEW

CA Insight Database Performance Monitor for Distributed Databases

DB Audit Expert 3.1. Performance Auditing Add-on Version 1.1 for Microsoft SQL Server 2000 & 2005

Analyzing IBM i Performance Metrics

The Complete Performance Solution for Microsoft SQL Server

The Top 10 Things DBAs Should Know About Toad for IBM DB2

Customer evaluation guide Toad for Oracle v12 Database administration

Response Time Analysis

SolarWinds Database Performance Analyzer (DPA) or OEM?

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

BMC ProactiveNet Performance Management Application Diagnostics

Monitor and Manage Your MicroStrategy BI Environment Using Enterprise Manager and Health Center

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

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

Proactive Performance Monitoring Using Metric Extensions and SPA

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

Oracle Enterprise Manager 13c Cloud Control

Development Best Practices

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

Configuring SQL Server Lock (Block) Monitoring With Sentry-go Quick & Plus! monitors

Oracle Database 11g: SQL Tuning Workshop

DATABASE VIRTUALIZATION AND INSTANT CLONING WHITE PAPER

MyOra 3.5. User Guide. SQL Tool for Oracle. Kris Murthy

Proactive Performance Management for Enterprise Databases

ITPS AG. Aplication overview. DIGITAL RESEARCH & DEVELOPMENT SQL Informational Management System. SQL Informational Management System 1

SQL Server Performance Tuning and Optimization

Oracle Database Monitoring for the Beginner. Chris Grabowy First Consulting Group

Quick Start Guide. Ignite for SQL Server. Confio Software 4772 Walnut Street, Suite 100 Boulder, CO CONFIO.

Case Study: Load Testing and Tuning to Improve SharePoint Website Performance

Today s business systems have undergone a radical transformation in order to meet

Databases Going Virtual? Identifying the Best Database Servers for Virtualization

SQL Server Performance Intelligence

Server & Application Monitor

Network Management and Monitoring Software

SQL Server Performance Tuning for DBAs

Microsoft SQL Server: MS Performance Tuning and Optimization Digital

Product Review: James F. Koopmann Pine Horse, Inc. Quest Software s Foglight Performance Analysis for Oracle

SAP HANA PLATFORM Top Ten Questions for Choosing In-Memory Databases. Start Here

MONyog White Paper. Webyog

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

Why Standardize on Oracle Database 11g Next Generation Database Management. Thomas Kyte

IBM Tivoli Composite Application Manager for WebSphere

Working with SQL Server Agent Jobs

Response Time Analysis

Monitoring Siebel Enterprise

SOLARWINDS NETWORK PERFORMANCE MONITOR

DBA 101: Best Practices All DBAs Should Follow

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/-

Model Manage Monitor Maximize your Data Center

Maximizing Performance for Oracle Database 12c using Oracle Enterprise Manager

Oracle Enterprise Manager 12c Microsoft SQL Server Plug-in version

Identifying Problematic SQL in Sybase ASE. Abstract. Introduction

Data Compression in Blackbaud CRM Databases

VirtualCenter Database Performance for Microsoft SQL Server 2005 VirtualCenter 2.5

MySQL Enterprise Edition Most secure, scalable MySQL Database, Online Backup, Development/Monitoring Tools, backed by Oracle Premier Lifetime Support

Monitoring applications in multitier environment. Uroš Majcen A New View on Application Management.

Real-time Data Replication

Selecting the Right Change Management Solution Key Factors to Consider When Evaluating Change Management Tools for Your Databases and Teams

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

Performance Management for Enterprise Applications

Database Maintenance Essentials

HP OpenView Smart Plug-in for Microsoft SQL Server

TUTORIAL WHITE PAPER. Application Performance Management. Investigating Oracle Wait Events With VERITAS Instance Watch

Oracle Database Performance Management Best Practices Workshop. AIOUG Product Management Team Database Manageability

CA Insight Database Performance Monitor for DB2 for z/os

Transcription:

Optimizing Your Database Performance the Easy Way by Diane Beeler, Consulting Product Marketing Manager, BMC Software and Igy Rodriguez, Technical Product Manager, BMC Software Customers and managers of the companies who serve them demand instant, fast access to information. This means that the database administrators (DBAs) who are responsible for this information must optimize the performance and availability of databases and anticipate and head off bottlenecks before they happen. These DBAs must be familiar with multiple database platforms, operating systems, and hardware platforms with little to no training. Maintaining database performance and availability is a challenging task. There are many events that can impact database performance. Once these events occur, it is important to diagnose and resolve these issues quickly and easily. Most importantly, it is important to be proactive and notify the DBAs before these events actually occur and impact the user experience. How do DBAs normally handle performance problems? Let s take a look. Manual Optimization of Database Performance One of the most common reasons for poor database performance is un-tuned SQL. There are many rules and guidelines that need to be followed when queries are being written. If these rules are not followed, performance issues will be impacted. Some of these rules are as follows: If statement(s) use the NOT IN operator, rewrite them with NOT EXISTS Compose Predicates Using AND and =. Use equijoins. Avoid a full-table scan if it is more efficient to get the required rows through an index. Avoid using an index that fetches 10,000 rows from the driving table if you could instead use another index that fetches 100 rows and choose selective indexes. Choose the join order so you will join fewer rows to tables later in the join order. Set up the driving table to be the one containing the filter condition that eliminates the highest percentage of the table. Use untransformed column values. Do not use SQL functions in predicate clauses or WHERE clauses. Use functionbased indexes where possible. Avoid mixed-type expressions. When using IN and NOT IN with a subquery, try to rewrite it with WHERE (NOT) EXISTS as an alternative. Minimize the use of DISTINCT. Do not use inequality operators such as <>, =!.

Do not use IS NULL and IS NOT NULL. These rules can take the DBA anywhere from a couple of minutes to several hours each to analyze the SQL when it is done manually. When a SQL performance issue occurs in production, the DBA or developer attempting to address the issue does the following: Checks the SQL to make sure the rules listed above are being followed. Possibly rewrites the query. Re-runs EXPLAIN PLAN to see if a better access path is selected. Typical Manual Tuning Steps Here are the typical steps a DBA follows to tune SQL manually once he knows there are performance problems: 1. Locate the problem queries. 2. Run EXPLAIN PLAN. 3. Interpret the output. What is the operation order? Look at the full table scans. Look at join operations. 4. Look at the indexes. Are there too many? Are there any not being used? Is there no index? 5. Rewrite the query. 6. Run EXPLAIN PLAN. 7. Interpret the output. What is the operation order? Look at the full table scans. Look at join operations. 8. Compare with the previous EXPLAIN PLAN(s). 9. Is it better? If not, repeat all of the steps again. This process can take a while, depending on the tuning experience of the DBA or developer. To get the best performance, he would have to manually rewrite a query several different ways, run the query, and then write down statistics on how fast it ran. Did it improve? Did it improve enough? Was it fast enough? The DBA can spend many hours in trying to tune the SQL, and in the end, discover that it was an application design issue, not a SQL problem. There are issues that go beyond rewriting a query. EXPLAIN PLAN can show that the query is using the indexes that it is supposed to, but the performance is still bad. The potential cause could be unbalanced indexes, which can greatly impact query performance. If there are a large number of deletes on their associated tables, there will be unbalanced indexes. These indexes need to be rebuilt on a regular basis.

Using Proactive and Diagnostic Tools to Optimize Database Performance Some of the events that can impact database performance and availability are database configuration parameters, migrated rows, resource contention, and most important, untuned queries. Two types of tools are needed in order to ensure acceptable levels of performance and availability proactive and diagnostic. The proactive tools alert DBAs to problems that are getting close to unacceptable levels, and the diagnostic tools analyze and pinpoint problem areas and provide advice as to how to resolve issues. With the right tools, DBAs can substantially increase the performance and availability of their databases. BMC Software has several expert DBA tools that have built-in intelligence and automation. These tools can advise the DBA and make it easier for him to be effective and efficient. BMC Expert DBA Tools for Performance Optimization DBXray for Oracle DBXray is the personal productivity tool that allows database professionals of all experience levels to manage and master the everyday challenges of database administration from any PC with a common Internet browser simply, quickly and effectively. DBXray: Improves the performance and prevents outages of a database by identifying and eliminating database bottlenecks Delivers ready access from anywhere, anytime through a Web browser Provides detailed drilldown information on user session details, 24-hour database view, 10 data files with highest I/O hits, 4 top memory consumers, space management, delays caused by redo log space requests, locks blocking other sessions, transactions that must wait on a rollback segment for completion, waits and latches, and many other critical metrics Includes SmartDBA Cockpit for access even remotely via the Web to Oracle, DB2 UDB, and Microsoft SQL Server databases from one single console. DBXray, Space Expert, and SQL-Explorer plug in to SmartDBA Cockpit and the user can access them from this one single interface.

Space Expert for Oracle Space Expert for Oracle can analyze a database, predict problems, and help a DBA fix them before they even happen. It provides information on when a reorganization is needed and can even do the reorg online. Space Expert: Reorganizes 24/7 databases online, without downtime, providing complete read and write access to database applications Avoids unplanned outages by identifying objects that have high severity problems and provides recommended actions Reduces the need for future reorganizations by performing powerful analysis of object condition, producing ideal settings that restore the object to peak performance Performs automated sophisticated scheduling, object selection, multi-processing, and full checkpoint restart capability Includes SmartDBA Cockpit and DBXray SQL-Explorer for Oracle SQL-Explorer offers the most advanced SQL tuning technology in the industry, allowing DBAs to improve business application performance by proactively analyzing, diagnosing, managing and tuning databases and applications offline while preserving application and business availability. It lets DBAs collect data nonintrusively, analyze SQL statements, optimize a database, and do what-if analysis with exclusive simulation technology without impacting your production environment. SQL-Explorer: Prevents production interruption by using a non-intrusive high-speed data collector for capturing and saving SQL for later analysis Extends DBA resources and improves application performance by automatically providing expert tuning recommendations Reduces tuning time by displaying all relevant tuning information in an intuitive format Tunes SQL before releasing application Optimizes SQL that is tuned Provides indexing suggestions based on SQL execution

Includes SmartDBA Cockpit and DBXray Typical Tuning Steps Using DBXray, Space Expert, and SQL-Explorer When the DBA uses no tool, he typically does not know there are performance problems until after they have already occurred. With DBXray, he can instantly spot a performance problem on the database-at-a-glance screen. He can also be proactive and head off performance problems with the information provided in the monitors on the DBXray screen. Once he figures out that he has performance problems or that he will have performance problems if he doesn t take action now he can use SQL-Explorer and Space Expert to optimize the performance of his database. Here are the steps a DBA follows to tune SQL using SQL-Explorer and Space Expert. 1. Use SQL-Explorer which automatically and quickly: Identifies queries that are affecting the performance of the database Gathers history via the High Speed Data Collector with very low overhead Runs EXPLAIN PLAN Displays several suggested query rewrites and a plain English explanation of execution steps Provides table definitions and defines indexes Uses simulation technology to run trials on a Virtual Instance to compare execution statistics No impact to production Great for long running queries Identifies the best query to use Compares EXPLAIN PLAN of the re-written SQL with the original SQL and color codes the differences 2. Use Space Expert to determine if indexes are selective or not and whether the indexes need to be rebuilt. Locate problem queries with SQL-Explorer Vendor Applications When using vendor applications like SAP, Siebel, and Oracle Financials, the SQL in the application cannot be modified. However, major performance gains can be achieved by using SQL-Explorer to analyze index usage and create indexes based on specific usage patterns in your database. SQL-Explorer can also be used to identify poorly written SQL in these applications. Even though you can t change the SQL from SQL-Explorer due to the restrictions in those applications, you can use SQL-Explorer to identify problem SQL and then the application vendors can fix it. Check selectivity of indexes and view index statistics with Space Expert

Customer Case BMC has a customer that was experiencing performance issues at specific times during the day. The DBA was running scripts to attempt to capture the problematic SQL. After several days of trying to do this manually, the DBA was not able to find the issue. Then DBXray, SQL-Explorer, and Space Expert were brought in to the picture. First he monitored user sessions with DBXray and noticed that there was a connection that was performing a great deal of physical I/O. He selected that session to view the SQL that was being executed, and selected the TUNE button. This took the SQL statement that was being executed by the session and pushed it to SQL-Explorer. The query was using NOT IN with a subquery. The subquery was not making use of available indexes. SQL-Explorer created a rewrite of the query. To see how the rewrites improved performance, he then selected the SQL statistics option from SQL- Explorer. When looking at the number of rows in the tables, he should have seen a greater improvement. More analysis was needed. Next a Find Problems job from Space Expert was executed. Much to his surprise, several indexes had experienced many deletes. The two indexes that were listed were ones that were needed to satisfy the query. Space Expert rebuilt the index and he ran the trials again. The query response time was dramatically improved by 85% - 100%. This is an interesting case where one layer of problems was peeled back and then another layer was exposed. An entry-level DBA with no tuning experience might struggle manually with the above problem for several days. An entry-level DBA could use DBXray, SQL-Explorer, and Space Expert and solve the problem in less than an hour. To solve the problem in such a short time, the DBA followed these steps: 1. He noticed the problem in DBXray with the User Sessions Drilldown information. A lot of physical I/O indicates that there are some untuned not optimized SQL statements and this indicates to use SQL-Explorer. SQL-Explorer automatically considers all of the rules in optimizing a query and gives the DBA several different rewrites of the SQL statement. 2. The DBA used SQL-Explorer and ran the Get Actual SQL Stats. It showed all of the possible rewrites, the elapsed time it took to run, the number of buffer gets, CPU time, physical reads, and number of rows fetched. It put a green check mark next to the statement that had the best statistics of the rewrites. There were very large tables in this example. The DBA saw some improvement with the rewritten statement, but should have seen a great improvement by the rewrite that SQL-Explorer generated. It added a WHERE clause to the subquery, thereby making use of available indexes. The NOT IN was changed to a NOT EXIST (this is one of the above rules for creating a query) and this helped improve performance even further. NOT IN can suppress indexes even when they are there so now he has ensured that that is not a problem. At this point, some DBAs might give up and might say that they tuned the SQL statements to be as fast as possible. There could still be object-related issues

affecting performance such as fragmented tablespaces, migrated rows, and indexes that needed rebuilding. 3. With the click of a mouse button, the DBA moved over to Space Expert and ran Find Problems and discovered the index problem. Space Expert rebuilt the index. He ran the now optimized query and realized an 85% - 100% improvement in performance over the original query! Conclusion DBAs can ease their workloads and ensure that their databases are available and tweaked for top performance by using DBXray, Space Expert, and SQL-Explorer intelligent, automated, integrated DBA tools. Not only do these tools make DBAs jobs easier, they also dramatically cut the time to solve and prevent performance problems, and they ensure that their databases are available and operating at peak performance. For more information on BMC s database products, visit BMC Software on the Web at www.bmc.com/database. BMC Software, Inc. [NYSE: BMC], is the leading provider of enterprise management solutions. Through its Assuring Business Availability approach, BMC Software delivers control over infrastructure management costs, control of market advantage and differentiation via service management, and growth of business value with solutions for business optimization. BMC Software is a member of the S&P 500, with fiscal year 2001 revenues exceeding $1.5 billion and offices worldwide. BMC Software, the BMC Software logos and all other BMC Software product or service names are registered trademarks or trademarks of BMC Software, Inc. All other registered trademarks or trademarks belong to their respective companies. 2002, BMC Software, Inc. All rights reserved. 18278 07/02