You'll need to troubleshoot your query performance to determine why your queries are running so long. So turn on the Query Store and look for long-running and expensive queries.
SQL Server 2019 Express Edition with C# commandtime outs starting to occur frequently.
I have created a c# application using .NET 4.5.2 framework. It uses a SQL database I created in SQL Server 2019 express edition. The problem I am experiencing is now that I have been using my application for some months and the database has some size, the Sql commands sent from my c# app to Sql Server and failing to complete with commandtimout errors. If I specify a commandtimeout value (ie override the default 30 seconds) it works, but it bothers me that this happens. Am I going to have to continually bump the commandtimeout value as the database grows ?
It isn't one table or stored procedure that is getting timed out, it is all of them.
Ideas and thoughts greatly appreciated.
3 answers
Sort by: Most helpful
-
-
Erland Sommarskog 101.4K Reputation points MVP
2021-05-14T21:41:45.83+00:00 In addition to what David says, also check for blocking. Although, if the problem goes away with extending the command timeout, blocking may not be the primary reason. Then again, if there is an update operation that takes a long time, that is going affect all queries.
It is actually quite easy to determine this from the Query Store data, because if the execution time is 35 seconds, and the CPU time is just 1-2 seconds, it is very likely due to blocking.
In the end, you will need to start to considering better indexing for your database.
-
Darryl Hoar 116 Reputation points
2021-05-18T13:25:03.643+00:00 Interesting side note: No changes to the database and the application worked without any changes to the commandtimeout value. Strange.
I'll do the following:
- Evaluate the current table indexes and refine.
- Try and examine the Query Store data to determine slowness cause(s).
Since the computer is not close to me, I can't do the plan examination which I assume I need to do during execution.
Thanks.