We are using C# and Linq2SQL to get data from a database for some reports. In some cases this takes a while. More than 30 seconds, which seems to be the default CommandTimeout
.
So, I guess I have to up the CommandTimeout
. But question is, how much? Is it bad to just set it very high? Wouldn't it be bad if a customer was trying to do something and just because he happend to have a lot more data in his database than the average customer he couldn't get his reports out because of timeouts? But how can I know how much time it potentially could take? Is there some way to set it to infinity? Or is that considered very bad?
And where should I set it? I have a static database class which generates a new datacontext for me when I need it. Could I just create a constant and set it whenever I create a new datacontext? Or should it be set to different values depending on the usecase? Is it bad to have a high timeout for something that wont take much time at all? Or doesn't it really matter?
Too high ConnectionTimeout
can of course be more annoying. But is there a case where a user/customer would like something to time out? Can the SQL server freeze so that a command never finishes?