我如何决定什么时间作为超时使用长度使用SqlCommand对象时?
How do I decide what length of time to use as a timeout when using an SqlCommand object?
在的code我的工作零件(写别人)我有:
On parts of the code I'm working on (written by somebody else) I have:
cmd.CommandTimeout = 60;
我认为这是相当短。但是,我看到一些人在论坛上谈论它设置为30000,这似乎太长了。
Which I think is quite short. However, I have seen some people in forums talking about setting it to 30000, which seems too long.
我怎么知道什么是最适合我的应用?
How do I know what is best for my application?
推荐答案人们似乎都搞不清楚,这是否是秒或毫秒。该documentation指出,超时以秒为单位。 1分钟超时似乎是合理的大多数查询。一个8+小时超时的不的似乎是合理的。
It seems that people are confused as to whether this is seconds or milliseconds. The documentation states that the timeout is in seconds. A 1-minute timeout seems reasonable for most queries. An 8+ hour timeout doesn't seem reasonable.
你有你期待拿一分钟长的查询?如果是这样,将其抬高,您预计会比任何你会看到,如果一切工作正常高值,但不会高到采取永远提醒您注意的一个问题。 (例如,你可能会去从1分钟到5分钟。)
Do you have queries you're expecting to take longer than a minute? If so, raise it to a value you expect to be higher than anything you'd see if everything is working properly, but not so high as to take forever to alert you to a problem. (For example, you might go from 1 minute to 5 minutes.)
更多推荐
SqlCommand对象,什么时间进行的CommandTimeout长度是多少?
发布评论