Query Performance Tuning: Start to Finish

Slides:



Advertisements
Similar presentations
2000 SRM Associates, Ltd. Windows NT/2000 Performance and Capacity Key Metrics Jerry L. Rosenberg SRM Associates, Ltd.
Advertisements

SQL Server performance monitoring and tuning Buck Woody.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
Chapter 14 Chapter 14: Server Monitoring and Optimization.
Gather SQL Server Performance Data with PowerShell
11 MONITORING MICROSOFT WINDOWS SERVER 2003 Chapter 3.
MCITP Guide to Microsoft Windows Server 2008 Server Administration (Exam #70-646) Chapter 14 Server and Network Monitoring.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Chapter Ten Performance Tuning. Objectives Create a performance baseline Create a performance baseline Understand the performance and monitoring tools.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Performance Baselining, Benchmarking, and Monitoring
Hands-On Microsoft Windows Server 2008 Chapter 11 Server and Network Monitoring.
Copyright © 2007 Quest Software The Changing Role of SQL Server DBA’s Bryan Oliver SQL Server Domain Expert Quest Software.
Module 18 Monitoring SQL Server 2008 R2. Module Overview Monitoring Activity Capturing and Managing Performance Data Analyzing Collected Performance Data.
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
Key Concepts About Performance Factors Affecting SQL Performance SQL Performance Tuning Methodologies SQL Performance Tuning Tools 1.
© Wiley Inc All Rights Reserved. MCSE: Windows Server 2003 Active Directory Planning, Implementation, and Maintenance Study Guide, Second Edition.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Introducing the SQL Server 2008 Performance Data Collector by Brad McGehee August 20, 2008 Audio via phone conference (866) , the dial in code.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
Agenda for Today Do Chapter 14 Final Project Review for Final.
Performance Dash A free tool from Microsoft that provides some quick real time information about the status of your SQL Servers.
Monitoring Windows Server 2012
Learningcomputer.com SQL Server 2008 – Profiling and Monitoring Tools.
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
SQLRX – SQL Server Administration – Tips From the Trenches SQL Server Administration – Tips From the Trenches Troubleshooting Reports of Sudden Slowdowns.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
CH 13 Server and Network Monitoring. Hands-On Microsoft Windows Server Objectives Understand the importance of server monitoring Monitor server.
Troubleshooting SQL Server Performance: Tips &Tools Amit Khandelwal.
Monitoring and Managing Server Performance. Server Monitoring To become familiar with the server’s performance – typical behavior Prevent problems before.
Windows Server 2003 系統效能監視 林寶森
MISSION CRITICAL COMPUTING Siebel Database Considerations.
Presented by Vishy Grandhi.  Lesson 1: AX Overview  Lesson 2: Role based security  Lesson 3: Monitoring  Troubleshooting.
FINDING THE “MAKE IT FASTER!” BUTTON AND HITTING IT! Ewan MacKellar Senior Premier Field Engineer Microsoft SESSION CODE: SVR306 (c) 2011 Microsoft. All.
1 Chapter Overview Monitoring Access to Shared Folders Creating and Sharing Local and Remote Folders Monitoring Network Users Using Offline Folders and.
Page 1 Monitoring, Optimization, and Troubleshooting Lecture 10 Hassan Shuja 11/30/2004.
ObjectCounterLook For Processor% Processor Time
Diagnosing Performance with Wait Statistics Robert L Davis Principal Database
Troubleshoot Customer Performance Problems Like a Microsoft Engineer Tim Chapman Senior Field Engineer, Microsoft.
Improve query performance with the new SQL Server 2016 query store!! Michelle Gutzait Principal Consultant at
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
SQL Database Management
AX Performance Tools Present and Future
Monitoring Windows Server 2012
An introduction to Wait Statistics
Curacao SQL Saturday June 11, 2016
Monitoring SQL with System Center
Troubleshooting SQL Server high CPU usage
Chapter 3: Process Concept
Benchmarking the forgotten Role of Performance Tuning
Hands-On Microsoft Windows Server 2008
MCTS Guide to Microsoft Windows 7
SQL Server Monitoring Overview
MONITORING MICROSOFT WINDOWS SERVER 2003
Software Architecture in Practice
Where to Start, What You Need
Microsoft Dumps Question Answer - Dumps4download
Troubleshooting SQL Server Basics
SQLSaturday 393- May 16, Redmond, WA
MapReduce Simplied Data Processing on Large Clusters
Proving Hardware Bottlenecks &
SQL Server 2016 Query Data Store
SQL Server Performance Tuning
Kris Hokanson That’s bad mmmkay! …Or, how to know when your SQL Server isn’t working as well as it could.
Chapter 3: Processes.
Using wait stats to determine why my server is slow
SharePoint 2013 Best Practices
The DBA Quit and now you’re it:
Presentation transcript:

Query Performance Tuning: Start to Finish Grant Fritchey

Who? Principal DBA for FM Global Microsoft SQL Server MVP PASS Chapter President Author: SQL Server Execution Plans SQL Server 2008 Query Performance Tuning Distilled

Why Tune Queries? Most volatile aspect of a database system Subject to changes in data Affected by changes in structure Impacted by poor coding choices Victim of resource contention

Query Performance Tuning – Start to Finish Gathering Metrics

Finish Line The ability to collect performance metrics on their servers as part of an overall query tuning methodology An understanding of how the optimizer works in support of writing better TSQL code as well as troubleshooting poorly performing queries The ability to generate, read, and understand execution plans from multiple sources in support of troubleshooting poorly performing queries A working knowledge of DMVs that will help them identify and fix performance issues on their servers The ability to address common query performance problems

Where to Start Tuning? Random Pick a query? Ask a user? Alphabetically? Knowledge based Baseline Metrics Records

Server Metrics Start Query Tuning at the Server Hardware Operating System SQL Server Establish a Baseline Now is a good time Save the data

Tools for the Baseline Performance Monitor Dynamic Management Objects (DMO) SQL Data Collection Third Party Software

Where Do Problems Occur? Memory Disk I/O Processor Network DO NOT SIMPLY TRUST THESE NUMBERS

Memory Object Counter Values Memory Pages/sec Peaks < 50 Page Faults/sec Compare with baseline value for trend analysis SQL Server: Buffer Manager Buffer cache hit ratio Average value >= 90 Page Life Expectancy Average value > 300 Checkpoint Pages/Sec Peak < 30 SQL Server:Memory Manager Memory Grants Pending Peaks = 0

Disk I/O Object Counter Values PhysicalDisk % Disk Time Peaks < 85% Avg. Disk Queue Length* Peaks < 3 per disk Disk Transfers/sec Maximum value < 100 per disk Avg. Disk sec/Read Compare to baseline Avg. Disk sec/Write * Meaningless on a SAN

Processor Object Counter Value Processor % Processor Time Peaks < 80% System Context Switches/sec Peaks < 1,000 Processor Queue Length Peaks < 3 SQL Statistics Batch Requests/sec Compare to Baseline SQL Compilations/sec Peaks > 100 SQL Recompilations/sec Processor Queue Length might be meaningless since SQL Server has it’s own thread manager

Network Object Counter Value Network Interface Bytes Total/sec Peaks < 50% of NIC capacity Network Segment % Net Utilization Peaks <80% of network bandwidth

Performance Monitor Positives: Absolute Best “Do It Yourself” Option Powerful Accurate Easy to Use Ubiquitous Negatives A lot of work to setup, maintain & clean data Very little direction Make sure you talk about & show capturing the data to file. & mention loading it into a database. Focus on the peaks. Don’t sweat the average Every 5 minutes

Dynamic Management Objects Positives Easy to use In a language you know Data is ready to query Ubiquitous Negatives Incomplete No direction

SQL Data Collection Positives Immediate results Pre-generated reports Easy to implement Negatives Enterprise Only 2008 Only Limited Data Set

Third Party Tools Positives Lots of Direction Ready to consume reports Immediate returns Negatives Costly May not collect what you need or want

Wait Stats & Queues sys.dm_os_wait_stats Sys.dm_exec_requests Sys.dm_waiting_tasks

Query Metrics This is where you live Too much information Save the data, just not in its original form DO NOT USE PROFILER ON PRODUCTION SYSTEMS

The Server Side Trace Profiler to Generate the Script Files work best Clean and Store the Data Profiler GUI can be used to Browse Data Works with Perfmon Data Schedule the Start and Stop

RML Utilities Free Huge Time Savings Excellent Resource Still Need Long-Term Storage & Reporting

Query DMOs Sys.dm_exec_requests Sys.dm_exec_query_stats Sys.dm_exec_procedure_stats

Metrics Resources http://bit.ly/fjD3oy “SQL Server 2008 Query Performance Tuning Distilled” Microsoft White Paper: Performance Tuning Waits and Queues.doc http://technet.microsoft.com/en- us/library/cc966413.aspx Microsoft White Paper: Troubleshooting Performance Problems in SQL Server 2008 http://msdn.microsoft.com/en-us/library/dd672789.aspx Brad McGehee “Mastering SQL Server Profiler” Louis Davidson & Tim Ford’s “Performance Tuning with SQL Server Dynamic Management Views”