Thursday, 19 November 2015

SQL Server Misconceptions - The Remote Query Timeout Setting

So this is the first post in a little series I’m doing about misconceptions within SQL Server. I’m going to be looking at a number of items that don’t work as you might think they do and a few of things that might look a good idea…but they’re really not.

So the particular setting that I am discussing today is the Remote Query Timeout option and you can find what this is currently set to by running the following bit of code in Management Studio:

sp_configure 'remote query timeout (s)'

Or, because SSMS is clever we could just use sp_configure 'remote query' instead and in both cases we'll get results similar to the following depending on your setting:


Now the common misconception with this option is probably because of the following screen within SQL Server Management Studio (Server Properties -> Connections) where we see the following.


So the first checkbox allows remote connections to the server so we could assume that the remote query timeout value underneath (here set to 600, the default) is for incoming connections to the server. We might think that we could change this because we're getting timeout errors within a client application when calling SQL and maybe changing this will help prevent the errors.

But we’d be wrong!

Here’s TechNet to explain why:

Use the remote query timeout option to specify how long, in seconds, a remote operation can take before Microsoft SQL Server times out. The default is 600, which allows a 10-minute wait. This value applies to an outgoing connection initiated by the Database Engine as a remote query. This value has no effect on queries received by the Database Engine.

That last line pretty much says everything we need to know, the value has NO EFFECT on queries RECEIVED by the Database Engine. None whatsoever, it is used purely for outgoing connections.

You can read more about this option here

1 comment:

  1. That was very enlightening ! indeed my client application is getting time out error when attempting to preform massive delete transaction from the DB. According to logic and my understanding I expected that setting a greater value to Remote Query Timeout would help solve this. but thanks to your explanation it seems I was wrong. Thank you for taking the time to inform others :)

    ReplyDelete