Taking a very simplified approach, your query that you send to SQL Server is either RUNNING or WAITING for resources. When it’s waiting, it is still running, right? When you are on your way to the office (think non-pandemic days 🙂 ), you wait for the elevator, you wait for the cab, etc. While you wait for many of these resources, you are still “on your way to office”. It’s the same with your query. In its lifetime of “the run”, it has to encounter many instances where it needs resources and it has to wait for them if those resources are not instantly available. SQL Server records these waits and you can capture them. This helps in understanding why was your query running “slow”. Well, the query never runs “slow”, it probably is just waiting for a resource. Let’s say it wants access to a data page that is locked by another transaction. On a lighter note, you never reach late to the office, it’s the obstacles you face on your way ;). If you can track and capture what your query was waiting on, query tuning becomes a lot simpler. Need a demo? Just put your request in the comments section and I will try to share a link to a video or a blog post. Sounds interesting? Watch the video below.
Get new content directly in your inbox – Click here
You can also visit DataPlatformGeeks (DPG) Video Library to watch more videos and to download video resources (presentation & demo code).
Hope the video was worth your time.