Share via

SQL Server database becoems non responsive on queries

-- -- 957 Reputation points
2021-11-19T02:34:00.717+00:00

Hi

SQL Server 2019 on a Windows Server 2019 vps.

We have this issue with queries in dotnet apps or even in SSIS queries that at times the queries on a database can get stuck for a very long time. At other times the queries on same database respond OK. We have run profiler on the database for extended time but have not received any 'Blocked process report'. We have scripted and re-created db in case database was corrupt but still no luck.

How can we track down the issue that is holding back the database from time to time.

Thanks

Regards

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 134.7K Reputation points MVP Volunteer Moderator
    2021-11-19T23:02:51.237+00:00

    We have run profiler on the database for extended time but have not received any 'Blocked process report'.

    To get this event, you need to configure this. For instance

    EXEC sp_configure 'blocked process threshold (s)', 15
    RECONFIGURE
    

    This setting cause the trace event to be fired if a process has been blocked for more than 15 seconds. If you decide to pick another value, pick a multiple of 5, because SQL Server checks for this condition every five seconds.

    But the issue is necessarily not blocking, it could also be that the query wobbles between different query plans. I recommend the article that Cathy pointed you to - because I wrote it. :-)

    Was this answer helpful?

    0 comments No comments

  2. CathyJi-MSFT 22,431 Reputation points Microsoft External Staff
    2021-11-19T06:32:04.447+00:00

    Hi @-- -- ,

    Did you mean that the query run in dotnet apps or using SSIS task execute query, the query will run for a long time. But the same query works well when it run in SSMS. If I misunderstood, please let me know.

    Suggest you reading the blog Slow in the Application, Fast in SSMS?

    If you mean that some query run for a long time at some time, but it works well at other times. Suggest you analyzing the execution plan of the slow query. Refer to the blog Execution Plans in SQL Server.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.