![Icon](/_next/image?url=https%3A%2F%2Fapi.glitter.io%2Fstorage%2Fv1%2Fobject%2Fpublic%2Ficons%2F2894cd6a-d669-4cd9-9fa3-33c256af1875%2Flocal-windows-1password.png&w=128&q=75)
Troubleshooting SQL Database Timeout Issues
Explore a troubleshooting technique for SQL databases, focusing on identifying and resolving timeout issues. Learn about query performance insights, execution plans, and the importance of database statistics.
In this guide, we'll learn how to troubleshoot SQL database performance issues, specifically focusing on identifying and optimizing poorly performing queries. By investigating SQL errors with timeout issues reported through AppInsights, we aim to enhance the database's efficiency.
Investigating SQL Database Performance
To begin, we'll delve into the SQL database for Platinum instance ProductionSupport32 to address the high DTU percentage observed recently.
Analyzing Query Performance Insights
We'll explore the query performance insights to pinpoint the top five worst-performing queries over the last 24 hours. By examining the execution counts and durations, we can isolate the problematic queries.
Optimizing Query Execution
We'll then focus on executing and analysing the identified queries to uncover any performance bottlenecks. By reviewing the execution plans and addressing warning signs like columns with no statistics, we aim to enhance query efficiency.
Let's get started.
We will explore a troubleshooting technique for SQL databases. A client reported plugman errors, and upon checking AppInsights, we identified SQL errors related to timeout issues. Let's delve into the SQL database to investigate further. To begin, access the SQL databases.
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/844cb81c-cfc1-4b8d-9dee-4db07432559b.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/9deb3e22-c142-4122-a2c4-94d44db3f96b.png)
When I check the monitoring tab and view it for the last few days, I can see high DTU percentage in the last day.
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/5a1b8181-c050-4890-960f-f39f049870ff.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/b77c2902-b02a-4647-bf51-1a65d931c3d4.png)
We will now explore query performance insights.
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/2298496a-04d8-480a-a788-718c15d346f0.png)
This will show us the top five worst-performing queries from the last 24 hours. The first query has been executed 57 times, taking a total of 17 minutes. Click on the query ID to view the query and analyze its execution plan for performance issues.
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/c3eea2f2-e13f-468f-9d75-5917b1c3bd1a.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/ae489fb0-756d-401c-93a0-81ced9761f71.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/75861b7d-d021-44c0-a6e2-9a3c3b5e4116.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/cf33d54d-162a-4bfa-93af-416a40b1cb3d.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/7b3e9df9-57f4-4195-8a06-24e73aac6816.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/42df4fe6-15dd-4143-8054-2cc15935c82b.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/549eca5d-fdae-4e6a-a28d-472d9ce7659e.png)
As you'll see, this will then take 12 seconds, as you can see at the very bottom of the screen. Normally, this query would take a second or so. If I click this button for "include actual execution plan" and then run it again, it will show me the execution plan, which might reveal performance issues.
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/eafd709a-1f39-4c5f-9334-3f8e45d4a4a2.png)
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/13f941d1-5202-4708-bee8-596259b2a5b5.png)
Results have appeared. Here's the execution plan, located in another tab.
In this case, we are focusing on the warning signs displayed here. There is a yellow triangle indicating a warning. If you hover over the triangle, it states: "Columns with no statistics." This identifies the problem with the database.
![](https://di8mn0rali2ic.cloudfront.net/uploads/9eff9c18-726b-4b43-8f70-b018786c6e52/053b96c9-87be-4701-84e1-bfa2cde5a590.png)
Thank you.