title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SET QUERY_GOVERNOR_COST_LIMIT (Transact-SQL) |
SET QUERY_GOVERNOR_COST_LIMIT (Transact-SQL) |
WilliamDAssafMSFT |
wiassaf |
06/10/2016 |
sql |
t-sql |
reference |
|
|
|
[!INCLUDE SQL Server SQL Database]
Overrides the currently configured query governor cost limit value for the current connection.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
SET QUERY_GOVERNOR_COST_LIMIT value
[!INCLUDEsql-server-tsql-previous-offline-documentation]
Is a numeric or integer value specifying the highest estimated cost allowed for a given query to run. Values are rounded down to the nearest integer. Negative values are rounded up to 0. The query governor disallows execution of any query that has an estimated cost exceeding that value. Specifying 0 (the default) for this option turns off the query governor, and all queries of any cost are allowed to execute.
Query cost is an abstract figure determined by the query optimizer based on estimated execution requirements such as cpu time, memory, and disk IO and refers to the estimated elapsed time, in seconds, that would be required to complete a query on a specific hardware configuration. This abstract figure does not equate to the time required to complete a query on the running instance, and should instead be treated as a relative measure.
Using SET QUERY_GOVERNOR_COST_LIMIT applies to the current connection only and lasts the duration of the current connection. Use the Configure the query governor cost limit Server Configuration Option option of sp_configure to change the server-wide query governor cost limit value. For more information about configuring this option, see sp_configure and Server Configuration Options (SQL Server).
The setting of SET QUERY_GOVERNOR_COST_LIMIT is set at execute or run time and not at parse time.
Requires membership in the public role.