Click here to Skip to main content
12,897,739 members (58,980 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 23 Jan 2014

SQL Server Performance Troubleshooting for Developers

, 23 Jan 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Some tips for developers who have to deal with a slow SQL server.


Suppose you have SQL server with performance issues, (web) apps become slow, there are timeouts, something has to be done.

  • If it's only your app accessing the SQL server, go ahead, use whatever profiler you like, fix SELECT N+1, optimize queries, etc.
  • If you have a (competent) DBA, let him or her handle it

But, what if your boss comes in and says "We have issues with a database server, you have to fix it. Oh, and by the way, we don't have access to the apps using it.

Of course Google will help you, sometime.

Here is what might be the result of some Google, trial and error:

  • Setup monitoring, e.g., New Relic's Server Monitoring and their SQL server plugin
  • Check same basics about the server (Power options, AV exclusions for db files, error in the EventLog or SQL server logs, etc.)
  • Ask Brent, the guy who helps running Stackoverflow on SQL server
    • Literally, Ask Brent
    • Read and watch whatever you can find on his site, it's pure gold!
  • Use sp_Blitz to get a quick overview of (potential) issues together with links offering background knowledge and tips on how to fix them
  • Find the most expensive missing indexes (see script below, I can't remember were I found it)
  • Run sp_BlitzIndex for single databases, start with the ones containing the most expensive missing indexes

If all of this doesn't help, it may be time to really ask for help...

SELECT TOP 25 ROUND(s.avg_total_user_cost * s.avg_user_impact * _
(s.user_seeks + s.user_scans),0) AS [Total Cost] ,
              d.[statement] AS [Table Name] ,
              equality_columns ,
              inequality_columns ,
FROM sys.dm_db_missing_index_groups g
INNER JOIN sys.dm_db_missing_index_group_stats s ON s.group_handle = g.index_group_handle
INNER JOIN sys.dm_db_missing_index_details d ON d.index_handle = g.index_handle
ORDER BY [Total Cost] DESC


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Markus Greuel
Germany Germany
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionIf you are mentioning a monitoring product Pin
Irit Gillath6-Jul-15 10:41
memberIrit Gillath6-Jul-15 10:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170424.1 | Last Updated 23 Jan 2014
Article Copyright 2014 by Markus Greuel
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid