Skip to content

Commit 9342a9e

Browse files
Clarify REQUEST_MAX_CPU_TIME_SEC behavior in SQL MI
1 parent 724c024 commit 9342a9e

3 files changed

Lines changed: 43 additions & 31 deletions

File tree

docs/relational-databases/event-classes/cpu-threshold-exceeded-event-class.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,39 @@ title: "CPU Threshold Exceeded Event Class"
33
description: "CPU Threshold Exceeded Event Class"
44
author: WilliamDAssafMSFT
55
ms.author: wiassaf
6-
ms.date: "03/04/2017"
6+
ms.date: 01/13/2025
77
ms.service: sql
88
ms.subservice: supportability
99
ms.topic: reference
1010
helpviewer_keywords:
1111
- "CPU Threshold Exceeded Event Class"
1212
monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current"
1313
---
14-
# CPU Threshold Exceeded Event Class
14+
15+
# CPU threshold exceeded event class
16+
1517
[!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)]
16-
The CPU Threshold Exceeded event class indicates that Resource Governor detects a query that exceeds the CPU threshold specified for REQUEST_MAX_CPU_TIME_SEC.
17-
18-
> [!NOTE]
19-
> The detection interval for this event is five seconds. It is guaranteed that an event will be generated if a query exceeds the specified limit by at least five seconds. However, if a query exceeds the specified threshold by less than five seconds, its detection might be missed depending on the timing of the query and the time of last detection sweep.
20-
21-
## CPU Threshold Exceeded Data Columns
22-
23-
|Data column name|Data type|Description|Column ID|Filterable|
24-
|----------------------|---------------|-----------------|---------------|----------------|
25-
|CPU|**int**|CPU usage in milliseconds.|18|Yes|
26-
|EventClass|**int**|214|27|No|
27-
|EventSubClass|**int**|CPU limit violation.|21|Yes|
28-
|GroupID|**int**|Group ID where the violation occurred.|66|Yes|
29-
|OwnerID|**int**|SPID of the process that caused the violation.|58|Yes|
30-
|SPID|**int**|ID of the server process that fires this event.<br /><br /> Note: This can differ from the actual user SPID if a system thread validates CPU usage as a background task.|12|Yes|
31-
|StartTime|**datetime**|The time when this event fired.|14|Yes|
32-
33-
## See Also
34-
[sp_trace_setevent &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-trace-setevent-transact-sql.md)
35-
36-
18+
19+
The **CPU threshold exceeded** event class indicates that resource governor detected a batch request that exceeds the CPU threshold specified for the `REQUEST_MAX_CPU_TIME_SEC` argument of a [workload group](../resource-governor/resource-governor-workload-group.md). For more information, see [CREATE WORKLOAD GROUP](../../t-sql/statements/create-workload-group-transact-sql#request_max_cpu_time_sec--value).
20+
21+
## CPU threshold exceeded data columns
22+
23+
| Data column name | Data type | Description | Column ID | Filterable |
24+
|:--|:--|:--|:--|:--|
25+
| CPU | **int** | CPU usage in milliseconds.| 18 | Yes |
26+
| EventClass | **int** | 214 | 27 | No |
27+
| EventSubClass | **int** | CPU limit violation. | 21 | Yes |
28+
| GroupID | **int** | Group ID where the violation occurred. | 66 | Yes |
29+
| OwnerID | **int** | SPID of the process that caused the violation. | 58 | Yes |
30+
| SPID | **int** | ID of the server process that fires this event.<br /><br /> Note: This can differ from the actual user SPID if a system thread validates CPU usage as a background task. | 12 | Yes |
31+
| StartTime | **datetime** | The time when this event fired. | 14 | Yes |
32+
33+
## Related content
34+
35+
- [sp_trace_setevent](../../relational-databases/system-stored-procedures/sp-trace-setevent-transact-sql.md)
36+
- [Resource governor](../../relational-databases/resource-governor/resource-governor.md)
37+
- [Resource governor workload group](../../relational-databases/resource-governor/resource-governor-workload-group.md)
38+
- [Create a workload group](../../relational-databases/resource-governor/create-a-workload-group.md)
39+
- [CREATE WORKLOAD GROUP](../statements/create-workload-group-transact-sql.md)
40+
- [ALTER WORKLOAD GROUP](../statements/alter-workload-group-transact-sql.md)
41+

docs/t-sql/includes/alter-workload-group.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: rwestMSFT
33
ms.author: randolphwest
44
ms.reviewer: dfurman
5-
ms.date: 01/01/2025
5+
ms.date: 01/13/2025
66
ms.service: sql
77
ms.topic: include
88
---
@@ -68,11 +68,13 @@ Starting with [!INCLUDE [sssql19-md](../../includes/sssql19-md.md)], the value c
6868
6969
#### REQUEST_MAX_CPU_TIME_SEC = *value*
7070

71-
Specifies the maximum amount of CPU time, in seconds, that a request can use. *value* must be 0 or a positive integer. The default setting for *value* is 0, which means unlimited.
71+
Specifies the maximum amount of CPU time, in seconds, that a batch request can use. *value* must be 0 or a positive integer. The default setting for *value* is 0, which means unlimited.
7272

73-
By default, resource governor doesn't prevent a request from continuing if the maximum time is exceeded. However, an event is generated. For more information, see [CPU Threshold Exceeded Event Class](../../relational-databases/event-classes/cpu-threshold-exceeded-event-class.md).
73+
When the maximum CPU time is exceeded, the `cpu_threshold_exceeded` extended event and a trace event are generated. For more information, see [CPU Threshold Exceeded Event Class](../../relational-databases/event-classes/cpu-threshold-exceeded-event-class.md).
7474

75-
Starting with [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] SP2 and [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CU3, and using [trace flag 2422](../database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf2422), resource governor aborts a request when the maximum CPU time is exceeded.
75+
In Azure SQL Managed Instance, when the maximum CPU time is exceeded, resource governor aborts the request with error 10961.
76+
77+
In [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)], resource governor doesn't abort the request by default. However, starting with [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] SP2 and [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CU3, resource governor aborts a request with error 10961 when [trace flag 2422](../database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf2422) is enabled and the maximum CPU time is exceeded.
7678

7779
#### REQUEST_MEMORY_GRANT_TIMEOUT_SEC = *value*
7880

docs/t-sql/includes/create-workload-group.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: rwestMSFT
33
ms.author: randolphwest
44
ms.reviewer: dfurman
5-
ms.date: 09/15/2022
5+
ms.date: 01/13/2022
66
ms.service: sql
77
ms.topic: include
88
---
@@ -69,11 +69,16 @@ Starting with [!INCLUDE [sssql19-md](../../includes/sssql19-md.md)], the value c
6969
7070
#### REQUEST_MAX_CPU_TIME_SEC = *value*
7171

72-
Specifies the maximum amount of CPU time, in seconds, that a request can use. *value* must be 0 or a positive integer. The default setting for *value* is 0, which means unlimited.
72+
Specifies the maximum amount of CPU time, in seconds, that a batch request can use. *value* must be 0 or a positive integer. The default setting for *value* is 0, which means unlimited.
7373

74-
By default, resource governor doesn't prevent a request from continuing if the maximum time is exceeded. However, an event is generated. For more information, see [CPU Threshold Exceeded Event Class](../../relational-databases/event-classes/cpu-threshold-exceeded-event-class.md).
74+
When the maximum CPU time is exceeded, the `cpu_threshold_exceeded` extended event and a trace event are generated. For more information, see [CPU Threshold Exceeded Event Class](../../relational-databases/event-classes/cpu-threshold-exceeded-event-class.md).
7575

76-
Starting with [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] SP2 and [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CU3, and using [trace flag 2422](../database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf2422), resource governor aborts a request when the maximum CPU time is exceeded.
76+
In Azure SQL Managed Instance, when the maximum CPU time is exceeded, resource governor aborts the request with error 10961.
77+
78+
In [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)], resource governor doesn't abort the request by default. However, starting with [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] SP2 and [!INCLUDE [sssql17-md](../../includes/sssql17-md.md)] CU3, resource governor aborts a request with error 10961 when [trace flag 2422](../database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf2422) is enabled and the maximum CPU time is exceeded.
79+
80+
> [!NOTE]
81+
> The detection interval for CPU time usage is five seconds. An event is generated if a query exceeds the specified limit by at least five seconds. However, if a query exceeds the specified threshold by less than five seconds, its detection might be missed depending on the timing of the query and the time of last detection sweep.
7782
7883
#### REQUEST_MEMORY_GRANT_TIMEOUT_SEC = *value*
7984

0 commit comments

Comments
 (0)