Is there any way, in SQL Server, to cause a batch to time out if its CPU usage exceeds some value specified in the batch? I need this to occur at the batch, and not the connection level.
Sql-server – Timeout on CPU usage
sql server
Related Question
- SQL Server 2008 – SQL Query in Suspended State Causing High CPU Usage
- Low CPU Usage on SQL Server Developer Edition 2014 – Causes
- CPU Usage Among NUMA Nodes in SQL Server
- Sql-server – Limit max CPU usage SQL SERVER with WSRM
- SQL Server – How to Get Breakdown of CPU Usage Over Time
- Sql-server – High CPU Usage on certain query when changing DB Compatibility Level
Best Answer
There has been a quick and dirty method in SQL Server for 20 plus years - you set the value of Query governor cost threshold to your arbitrary amount and then if the estimated cost of the execution plan exceeds that the query is rejected - I believe the end user receives some kind of error message but I haven't seen this enabled in the wild for a VERY long time so can't remember any details.
NB: more than just CPU costs is included from the link : CPU time, memory, and disk IO.