Presentation on theme: "5 Common SQL Server Performance Issues Jason Hall-SQL Sentry, Dir of Client Services Blog-jasonhall.blogs.sqlsentry.net."— Presentation transcript:
5 Common SQL Server Performance Issues Jason Hall-SQL Sentry, Dir of Client Services Emailfirstname.lastname@example.org@sqlsentry.net Twitter-@SQLSaurus Blog-jasonhall.blogs.sqlsentry.net
Agenda Tutorial Level 1 – The Easy Stuff Level 2 – A Little Tougher Level 3 – The Gloves Are Off Hidden Level Wrap-up
Who is Jason Hall? Director of Client Services @ SQL Sentry, Inc. Microsoft Platform Developer Since 1998 SQL Server Developer Since 6.5 Microsoft Certified Former US Army Paratrooper Horror Fan 3
Tutorial (aka) What is this? Each level covers 1 or 2 performance issues The end of each level is a boss fight (demo) After level 3 we have a short Q&A (preparation for war) The final boss battle! Note: I will be using some SQL Sentry tools for demos. This is purely for making things easier to demonstrate for me. This is not a commercial presentation, so if you have questions about the tools I’m using, please see me after the presentation, or send me an email later. I spend a large portion of each day looking through performance reports and dashboards from various organizations around the world. As a result I've identified some very common performance problems and/or misunderstandings that tend to have easy, though not always obvious, solutions. I want to share the “whys and hows” of these with you today.
Misunderstood “Timeout Expired…" Can be a connection timeout or an operation timeout; We’re talking about operation timeouts here Controlled by the client, not the server Not related to “Remote Query Timeout” in server connection properties Not even necessarily due to a long running or poor performing query
What to do Monitor general server performance and rule out server resource contention Use various methods to determine the specific query that is timing out, try to get the execution plan and tune it. Statistics Indexes Code
Misunderstood CXPACKET Waits Perfectly normal wait type associated with parallelism Usually a sign of another problem* Don’t just set MAXDOP to 1 #1 SQL Server wait type that I see when people are trying to troubleshoot a specific slow query or process
What to do Check statistics and update if needed Check for missing or unused indexes Cost Threshold for Parallelism Consider refactoring the query As a last resort consider looking at MAXDOP http://www.sqlskills.com/blogs/paul/maxdop-configuration-survey-results/ http://www.sqlskills.com/blogs/paul/maxdop-configuration-survey-results/
Memory Pressure #1 most common performance problem that I see Symptoms can mimic IO problems A good example of why you should not necessarily take action based on a single performance metric Consider NUMA architecture when monitoring Page Life Expectancy http://www.sqlskills.com/blogs/paul/page-life-expectancy-isnt-what-you-think/ http://www.sqlskills.com/blogs/paul/page-life-expectancy-isnt-what-you-think/
What to do Cap Max Memory on SQL Server Add more memory Don’t forget about watching for uneven NUMA load
Auto Update Statistics What are the default rules? http://www.sqlskills.com/blogs/erin/understanding-when-statistics-will-automatically-update/ We have large tables and indexes, and they are just getting larger. In many cases, the default is not good enough Know how to recognize this issue, and target statistic updates on schedule Worst case, you can change the rules - http://support.microsoft.com/kb/2754171 http://support.microsoft.com/kb/2754171
TempDB PAGELATCH Contention Becoming more common. I’m not sure if it’s more because of my awareness of it, or because it really is happening more Latch contention on allocation pages Heavy use of tempDB on a server where tempDB has a default configuration One of the better explanations is here by Robert Davis http://www.sqlservercentral.com/blogs/robert_davis/2010/03/05/Breaking-Down-TempDB-Contention/ http://www.sqlservercentral.com/blogs/robert_davis/2010/03/05/Breaking-Down-TempDB-Contention/
What to do Configure tempDB following best practices Multiple even sized data files Fast dedicated storage Read this http://support.microsoft.com/kb/2154845http://support.microsoft.com/kb/2154845
Agent History Retention Strange issues with Agent and Agent Jobs can be tracked to this Tables aren’t indexed with consistent querying in mind Don’t set retention to unlimited Default is usually good enough
Wrap Up 1.I recently updated my blog with a similar post on the top Windows issues that I encounter that may effect SQL Server performance. 2.Check out http://answers.sqlperformance.com/http://answers.sqlperformance.com/ 3.PLEASE stop by and thank the sponsors. Yes they are here trying to sell stuff, but they are also giving up their weekend to sponsor this event, and they don’t even get to attend sessions (sad face). 4.Make sure and thank the event organizers for their heroic efforts in putting this SQL Saturday together!