[dba-VB] C# SQLCommand.Timeout

jwcolby jwcolby at colbyconsulting.com
Tue Dec 1 09:24:10 CST 2009


Mark,

Thanks for the response.

 >If it takes three weeks, you will find out anyway, but why kill it after ten mins when it would 
have finished successfully in 19.45 minutes.

I hear you!

BTW how do you kill an executing stored procedure?

John W. Colby
www.ColbyConsulting.com


Mark Breen wrote:
> Hello John,
> 
> I have struggled with this value, and mixed it up with the connectionTimeout
> also.  As a result, when I think there will be a delay, I also set it to
> zero, and then I sleep easy.  I did that two years ago with
> out troublesome app, and now it works and works and works.  Whats the
> downside of infinite timeout.  If it takes three weeks, you will find out
> anyway, but why kill it after ten mins when it would have finished
> successfully in 19.45 minutes.
> 
> 
> Mark
> 
> 
> 
> 
> 2009/11/30 jwcolby <jwcolby at colbyconsulting.com>
> 
>> Any words of wisdom on setting the command.Timeout property?  I have stored
>> procedures that execute
>> instantly, and others that can take an hour or more (large appends).
>>
>> How can I discover how long a stored procedure takes to run so that I can
>> set this property
>> dynamically?  As an example I have cases where I am appending 65 million
>> rows into a table of 6
>> fields.  This can take a long time (at the very least perhaps 20 minutes)
>> but if I could get a
>> "RecordsAffected" count for such queries as well as the time it took to
>> execute, then I could start
>> to discover that it takes "X seconds / million" records, and set the
>> timeout to a reasonable value
>> based on the records to be appended.
>>
>> This doesn't have to be any exact time value.  I assume a simple pair of
>> time variables, then "stop
>> time - start time"?
>>
>> Or should I just discover worst case and set it to that?
>> --
>> John W. Colby
>> www.ColbyConsulting.com
>> _______________________________________________
>> dba-VB mailing list
>> dba-VB at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/dba-vb
>> http://www.databaseadvisors.com
>>
>>
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com
> 
> 



More information about the dba-VB mailing list