I look at my code's logs, and see that a query to delete something which occurs like 200 times a day, sometimes times-out. I have no clue to how to debug this. Because it's a very random behavior. Nothing is changed accept that the size of database is growing under operation. This is a pseudo-log:

8/20/2016 9:31:13 AM-Error:
The wait operation timed out
at Repository.UserHistoryRepository.Delete(15);

As you can see, this is the only information that I have. That a delete operation is timed-out at time X. I'm stuck at how to debug this and find out the cause. I don't know even from where to start.

I'm using SQL Server 2014.

  • 1
    Which DBMS is the question about? Aug 20 '16 at 8:15
  • My first thought is that you are missing an index. So when the query tries to delete a certain number of rows it times out. Can you put the query into management studio, and run it using the estimated query plan set on (you probably want to do this with a copy of the production db on a non production server). Can you post a screenshot of the results? You'll be initially looking for a table scan.
    – tommyfly
    Aug 20 '16 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.