The query has been canceled because the estimated cost of this query () exceeds the configured threshold of 3000. Contact the system administrator.

Databases > MS SQL 2012
Error:

The query has been canceled because the estimated cost of this query () exceeds the configured threshold of 3000. Contact the system administrator.

Cause:

QUERY_GOVERNOR_COST_LIMIT - Is a numeric or integer value specifying the longest time in which a query can run. "Query cost" refers to the estimated elapsed time, in seconds, required to complete a query on a specific hardware configuration.
For shared hosting, we need to guarantee all customers get a good performance when run applications, so we have to set QUERY_GOVERNOR_COST_LIMIT to 3000 by default.
And please note that your query estimated cost may be different on different SQL server versions. For example, SQL 2014 web and SQL 2019 web edition may show a different result. Normally, we always recommend our customers to create database on the latest version of SQL server.
 
 
Resolution:
Overrides the currently configured query governor cost limit value for the current connection. The below is an example that increases QUERY_GOVERNOR_COST_LIMIT to 15000. If your own query estimated cost is 14000, you will need to set below value larger than it. The setting of SET QUERY_GOVERNOR_COST_LIMIT is set at execute or run time and not at parse time. You need to run the query at the beginning of each query which needs to run over the threshold limit of 3000.
 
SET QUERY_GOVERNOR_COST_LIMIT 15000
SELECT *
FROM V_COMVEC_APUNTE
ORDER BY FechaApunte DESC
 
Note: increasing the query governor cost is not a good solution, we would recommend paying more attention to your SQL statement and optimize it.