In the last post, we looked at how to see if your query is misbehaving, or if things are running normally.
Note that I didn’t say “good” here. Just normal.
What Have You Done For Me Lately?
Using sp_WhoIsActive in a slightly different way, we can see what a query has been up to over a duration of our choosing.
The delta columns are what happened over the span of time we pick. The columns that come back normally are cumulative to where the query is at now.
So for a 5 seconds interval:
EXEC sp_WhoIsActive @delta_interval = 5;
I’m stacking a couple screens shots from the normal single line of results, because they’re a little too wide all at once.
What deltas can help you figure out is how “active” your query really is.
In other words, it can answer the question: is my query stuck, or is my query doing something?
As an example, here’s a query that opened a transaction, ran an update, and then… sat there.
Over all, we’ve done 4.4 million reads, 80k writes, and used about 7k ms of CPU.
But in the last five seconds, we haven’t done anything at all.
Thanks for reading!
If this is the kind of SQL Server stuff you love learning about, you’ll love my training. I’m offering a 75% discount to my blog readers if you click from here. I’m also available for consulting if you just don’t have time for that and need to solve performance problems quickly.