Timeout settings in SQL Server

Source: Internet
Author: User
Tags sql client sql server management sql server management studio

Part 1ArticleWe have summarized the timeout settings in Sharepoint. The article says that SQL-side options will not have any impact. Why?

I was dizzy, so I went to consult Peter, a Senior Technical Support Engineer of SQL and got the following answer.

1. SQL-related timeouts are initiated by the client.

For example, we write a C # smallProgramSqlcommand is used. commandtimeout attribute, specifying its value as 20 seconds. then, after the query is executed on the SQL side for 20 seconds, our C # applet will send a TDS tension packet to SQL Server, telling SQL server that I have timed out, you do not need to perform the query. therefore, the request of the corresponding SQL client breaks down the connection. the client reports an exception, indicating that the SQL server has been running for too long and exceeds our original time limit.

 

2. What are the two timeout options in SQL Server Management studio?

    • A. Tools-> options-> query exection-> execution time-out.

    • B. Right click SQL Server Node-> properties-> connections-> remote query timeout.

 

If we regard management studio as a self-written C # program, in this program, we only write down the statements to be executed and set timeout? The value specified by option A here is sqlcommand. commandtimeout. You can understand it. ^_^

 

Assume that our C # applet connects to SQL Server 1 and runs the stored procedure to fetch data. In this stored procedure, SQL Server 1 needs to fetch the raw data from SQL Server 2. if the query on SQL Server 2 is executed after 600 seconds (default value), SQL Server 1 will send it to SQL Server 2, telling it that this query is too long for me, you don't want to do it. so SQL Server 1 sends SQL Server 2 A data packet and tells it to stop. server 2 then breaks the connection between them.

 

It can be seen that in general, option B is not closely related to us.

 

When I studied these two options, I found that some netizens on stackoverflow.com asked related questions. The people who answered the questions often gave these two options. this is actually wrong. after the adjustment, the SQL running timeout issue will not be improved.

 

I would like to thank Peter Zhu for his wonderful explanation. I will share it with you here.

 

There is no end to technology. There are so many tricks behind such a small option.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.