query wait Option

In Microsoft® SQL Server™, memory-intensive queries, such as those involving sorting and hashing, are queued when there is not enough memory available to run the query. The query times out after a set amount of time calculated by SQL Server (25 times the estimated cost of the query) or the time amount specified by the non-negative value of the query wait.

Use the query wait option to specify the time in seconds (from 0 through 2147483647) that a query waits for resources before timing out. If the default value of -1 is used, then the time-out is calculated as 25 times of the estimated query cost.


Important A query may hold locks while it waits for memory. In rare situations, it is possible for an undetectable deadlock to occur. Decreasing the query wait time prevents such deadlocks from occurring. Eventually, a waiting query will be terminated and its locks released. However, increasing the maximum wait time may increase the amount of time for the query to be terminated. Changes to this option are not recommended.


query wait is an advanced option. If you are using the sp_configure system stored procedure to change the setting, you can change query wait only when show advanced options is set to 1. The setting takes effect immediately (without a server stop and restart).

To set the query wait option

    

See Also
RECONFIGURE sp_configure
Setting Configuration Options Thread and Fiber Execution

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.