For the DBA brought up on DBCCs and the system catalog views, the number of tools for troubleshooting SQL Server performance problems has recently expanded at a dizzying rate.
Profiler has evolved into an excellent "real time" performance diagnostic tool. Dynamic Management Views (DMVs) provide a vast array of performance data on previously "closed" areas of the database engine. On top of this you have dashboard reports, RML utilities, SQLDiag, and so on, as well as any number of hand-rolled tools that crop up in blogs and articles.
Despite the unquestionable value of many of these tools, I believe that few DBAs have actually used them. It remains difficult to coax them away from "tried and trusted" stalwarts such as sysprocesses and sp_who2. Why is this? Aside from the daunting complexity of some of these tools, there is the problem of information overload. Having all of this extra data doesn't necessarily make it simpler for a DBA to pinpoint the exact cause of a performance problem. These tools all collect data at the Server, or at best database, level. With the vast array of subtly different ad-hoc SQL queries that bombard your servers and databases, having this information doesn’t seem to make it any easier to work out which queries are causing your performance problems.
Fortunately, we may be approaching the "next frontier" of performance troubleshooting. The people over at SQLCAT have just released a very nice open-source tool, called ExtendedEventsWaitstats. It consists of a set of T-SQL scripts and a set of report definition files. This project uses the Extended Events framework, supported by Waitstats event data available from the DMVs, to provide response time analysis at the session or statement level. It enables you to see the time spent in serving the user requests and the time spent in waiting for resources
It's tempting to dismiss it as just Yet Another Performance Profiling technique, but I really believe this one is different. It is based on the simple, but elegant, formula:
Response time = service time + wait time
By collecting Waitstats data at the session level, you can find out exactly how much time each session spends processing, and where it spends it, and exactly how much time it spends waiting for other processes to complete. This makes performance diagnosis a whole lot easier. If, for example, you find that user requests are spending significant periods of time writing to the transaction log, or waiting to write to it, then you immediately know that you need to optimize that process, as well as speed up (or remove load from) your log drives.
Although the technique has been popular for many years in Oracle (where it really is referred to as "YAPP"), it hasn’t been developed very far by Microsoft until recently. The Release of ExtendedEventsWaitstats seems to signal a welcome change towards a simple way for beleaguered DBAs to pinpoint the exact point of performance problems in SQL code.