Approaching Database Server Performance Issues 2
Approaching Database Server Performance Issues
In the Part 1, we have seen how quickly we can check the runnable task and I/O pending task on an SQL server instance. This is very light weight script and it will give the result even if the server is under pressure and will give an over all state of the server at that moment.
The next step (Step2) in my way of diagnosing is to check the session that are waiting of any resources. Below script will help us. This query required a function as prerequisite, which will help us to display the SQL server agent job name if the session started by SQL server agent.
If there is a session with very long wait_duration_ms and not blocked by any other session and not going away from the list in the subsequent execution of the same query, I will look into the program name,host name,login name and the statement that is running which will give me an idea about the session.Based on all these information, I might decide to kill that session and look into the implementation of that SQL batch. If the session is blocked, I will look into the blocking session using a different script which I will share later.(Refer this post)
The next step (Step 3) is to list all session which are currently running on the server. I use below query to do that.
/***************************************************************************************