You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit df92db8
Browse filesBrowse the repository at this point in the historyBrowse files
Creates a Resource Governor workload group and associates the workload group with a Resource Governor resource pool. Resource Governor is not available in every edition of [!INCLUDE[msCoName](../../includes/msconame-md.md)][!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. For a list of features that are supported by the editions of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], see [Features Supported by the Editions of SQL Server 2016](~/sql-server/editions-and-supported-features-for-sql-server-2016.md).
27
+
Creates a Resource Governor workload group and associates the workload group with a Resource Governor resource pool. Resource Governor is not available in every edition of [!INCLUDE[msCoName](../../includes/msconame-md.md)][!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. For a list of features that are supported by the editions of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], see [Features Supported by the Editions of SQL Server 2016](~/sql-server/editions-and-supported-features-for-sql-server-2016.md).
28
28
29
29
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md).
30
30
31
31
## Syntax
32
-
33
32
```
34
33
CREATE WORKLOAD GROUP group_name
35
34
[ WITH
@@ -48,32 +47,30 @@ CREATE WORKLOAD GROUP group_name
48
47
```
49
48
50
49
## Arguments
51
-
*group_name*
52
-
Is the user-defined name for the workload group. *group_name* is alphanumeric, can be up to 128 characters, must be unique within an instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], and must comply with the rules for [identifiers](../../relational-databases/databases/database-identifiers.md).
53
-
54
-
IMPORTANCE = { LOW | **MEDIUM** | HIGH }
55
-
Specifies the relative importance of a request in the workload group. Importance is one of the following, with MEDIUM being the default:
50
+
*group_name*
51
+
Is the user-defined name for the workload group. *group_name* is alphanumeric, can be up to 128 characters, must be unique within an instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)], and must comply with the rules for [identifiers](../../relational-databases/databases/database-identifiers.md).
56
52
53
+
IMPORTANCE = { LOW | **MEDIUM** | HIGH }
54
+
Specifies the relative importance of a request in the workload group. Importance is one of the following, with MEDIUM being the default:
55
+
57
56
- LOW
58
57
- MEDIUM (default)
59
58
- HIGH
60
59
61
60
> [!NOTE]
62
61
> Internally each importance setting is stored as a number that is used for calculations.
63
62
64
-
IMPORTANCE is local to the resource pool; workload groups of different importance inside the same resource pool affect each other, but do not affect workload groups in another resource pool.
63
+
IMPORTANCE is local to the resource pool; workload groups of different importance inside the same resource pool affect each other, but do not affect workload groups in another resource pool.
65
64
66
-
REQUEST_MAX_MEMORY_GRANT_PERCENT =*value*
67
-
Specifies the maximum amount of memory that a single request can take from the pool. This percentage is relative to the resource pool size specified by MAX_MEMORY_PERCENT.
65
+
REQUEST_MAX_MEMORY_GRANT_PERCENT =*value*
66
+
Specifies the maximum amount of memory that a single request can take from the pool. *value*is a percentage relative to the resource pool size specified by MAX_MEMORY_PERCENT. *value* is an integer up to [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] and afloat starting with [!INCLUDE[sql-server-2019](../../includes/sssqlv15-md.md)], with a default setting of 25. The allowed range for *value* is from 1 through 100.
68
67
69
68
> [!NOTE]
70
69
> The amount specified only refers to query execution grant memory.
71
70
72
-
*value* must be 0 or a positive integer. The allowed range for *value* is from 0 through 100. The default setting for *value* is 25.
73
-
74
-
Note the following:
75
-
76
-
- Setting *value* to 0 prevents queries with SORT and HASH JOIN operations in user-defined workload groups from running.
71
+
Note the following:
72
+
73
+
- Setting *value* to 0 prevents queries with SORT and HASH MATCH operations in user-defined workload groups from running.
77
74
78
75
- We do not recommend setting *value* greater than 70 because the server may be unable to set aside enough free memory if other concurrent queries are running. This may eventually lead to query time-out error 8645.
79
76
@@ -86,25 +83,23 @@ CREATE WORKLOAD GROUP group_name
86
83
>
87
84
> Be aware that both cases are subject to time-out error 8645 if the server has insufficient physical memory.
88
85
89
-
REQUEST_MAX_CPU_TIME_SEC =*value*
90
-
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.
86
+
REQUEST_MAX_CPU_TIME_SEC =*value*
87
+
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.
91
88
92
89
> [!NOTE]
93
90
> By default, Resource Governor will not prevent a request from continuing if the maximum time is exceeded. However, an event will be generated. For more information, see [CPU Threshold Exceeded Event Class](../../relational-databases/event-classes/cpu-threshold-exceeded-event-class.md).
94
91
95
92
> [!IMPORTANT]
96
93
> Starting with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] SP2 and [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] CU3, and using [trace flag 2422](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md), Resource Governor will abort a request when the maximum time is exceeded.
97
94
98
-
REQUEST_MEMORY_GRANT_TIMEOUT_SEC =*value*
99
-
Specifies the maximum time, in seconds, that a query can wait for a memory grant (work buffer memory) to become available.
95
+
REQUEST_MEMORY_GRANT_TIMEOUT_SEC =*value*
96
+
Specifies the maximum time, in seconds, that a query can wait for a memory grant (work buffer memory) to become available.*value* must be 0 or a positive integer. The default setting for *value*, 0, uses an internal calculation based on query cost to determine the maximum time.
100
97
101
98
> [!NOTE]
102
99
> A query does not always fail when memory grant time-out is reached. A query will only fail if there are too many concurrent queries running. Otherwise, the query may only get the minimum memory grant, resulting in reduced query performance.
103
100
104
-
*value* must be 0 or a positive integer. The default setting for *value*, 0, uses an internal calculation based on query cost to determine the maximum time.
105
-
106
-
MAX_DOP =*value*
107
-
Specifies the maximum degree of parallelism (DOP) for parallel requests. *value* must be 0 or a positive integer. The allowed range for *value* is from 0 through 64. The default setting for *value*, 0, uses the global setting. MAX_DOP is handled as follows:
101
+
MAX_DOP =*value*
102
+
Specifies the maximum degree of parallelism (DOP) for parallel requests. *value* must be 0 or a positive integer. The allowed range for *value* is from 0 through 64. The default setting for *value*, 0, uses the global setting. MAX_DOP is handled as follows:
108
103
109
104
- MAX_DOP as a query hint is effective as long as it does not exceed workload group MAX_DOP. If the MAXDOP query hint value exceeds the value that is configured by using the Resource Governor, the Database Engine uses the Resource Governor MAXDOP value.
110
105
@@ -116,40 +111,40 @@ CREATE WORKLOAD GROUP group_name
116
111
117
112
- After DOP is configured, it can only be lowered on grant memory pressure. Workload group reconfiguration is not visible while waiting in the grant memory queue.
118
113
119
-
GROUP_MAX_REQUESTS =*value*
120
-
Specifies the maximum number of simultaneous requests that are allowed to execute in the workload group. *value* must be a 0 or a positive integer. The default setting for *value*, 0, allows unlimited requests. When the maximum concurrent requests are reached, a user in that group can log in, but is placed in a wait state until concurrent requests are dropped below the value specified.
114
+
GROUP_MAX_REQUESTS =*value*
115
+
Specifies the maximum number of simultaneous requests that are allowed to execute in the workload group. *value* must be a 0 or a positive integer. The default setting for *value* is 0, and allows unlimited requests. When the maximum concurrent requests are reached, a user in that group can log in, but is placed in a wait state until concurrent requests are dropped below the value specified.
121
116
122
-
USING { *pool_name* | **"default"** }
123
-
Associates the workload group with the user-defined resource pool identified by *pool_name*. This in effect puts the workload group in the resource pool. If *pool_name* is not provided, or if the USING argument is not used, the workload group is put in the predefined Resource Governor default pool.
117
+
USING { *pool_name* | **"default"** }
118
+
Associates the workload group with the user-defined resource pool identified by *pool_name*. This in effect puts the workload group in the resource pool. If *pool_name* is not provided, or if the USING argument is not used, the workload group is put in the predefined Resource Governor default pool.
124
119
125
-
"default" is a reserved word and when used with USING, must be enclosed by quotation marks ("") or brackets ([]).
120
+
"default" is a reserved word and when used with USING, must be enclosed by quotation marks ("") or brackets ([]).
126
121
127
122
> [!NOTE]
128
-
> Predefined workload groups and resource pools all use lower case names, such as "default". This should be taken into account for servers that use case-sensitive collation. Servers with case-insensitive collation, such as SQL_Latin1_General_CP1_CI_AS, will treat "default" and "Default" as the same.
123
+
> Predefined workload groups and resource pools all use lower case names, such as "default". This should be taken into account for servers that use case-sensitive collation. Servers with case-insensitive collation, such as SQL_Latin1_General_CP1_CI_AS, will treat "default" and "Default" as the same.
129
124
130
-
EXTERNAL external_pool_name | "default"
131
-
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ( [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]).
125
+
EXTERNAL external_pool_name | "default"
126
+
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ( [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]).
132
127
133
-
Workload group can specify an external resource pool. You can define a workload group and associate with 2 pools:
128
+
Workload group can specify an external resource pool. You can define a workload group and associate with 2 pools:
134
129
135
130
- A resource pool for [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] workloads and queries
136
131
137
132
- An external resource pool for external processes. For more information, see [sp_execute_external_script (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql.md).
138
133
139
134
## Remarks
140
-
REQUEST_MEMORY_GRANT_PERCENT: Index creation is allowed to use more workspace memory than what is initially granted for improved performance. This special handling is supported by Resource Governor in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]. However, the initial grant and any additional memory grant are limited by resource pool and workload group settings.
141
-
142
-
**Index Creation on a Partitioned Table**
135
+
When `REQUEST_MEMORY_GRANT_PERCENT` is used, index creation is allowed to use more workspace memory than what is initially granted for improved performance. This special handling is supported by Resource Governor in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]. However, the initial grant and any additional memory grant are limited by resource pool and workload group settings.
143
136
144
-
The memory consumed by index creation on non-aligned partitioned table is proportional to the number of partitions involved. If the total required memory exceeds the per-query limit (REQUEST_MAX_MEMORY_GRANT_PERCENT) imposed by the Resource Governor workload group setting, this index creation may fail to execute. Because the "default" workload group allows a query to exceed the per-query limit with the minimum required memory, the user may be able to run the same index creation in "default" workload group, if the "default" resource pool has enough total memory configured to run such query.
137
+
**Index Creation on a Partitioned Table**
138
+
The memory consumed by index creation on non-aligned partitioned table is proportional to the number of partitions involved. If the total required memory exceeds the per-query limit `REQUEST_MAX_MEMORY_GRANT_PERCENT` imposed by the Resource Governor workload group setting, this index creation may fail to execute. Because the *"default"* workload group allows a query to exceed the per-query limit with the minimum required memory, the user may be able to run the same index creation in *"default"* workload group, if the *"default"* resource pool has enough total memory configured to run such query.
145
139
146
140
## Permissions
147
-
Requires CONTROL SERVER permission.
141
+
Requires `CONTROL SERVER` permission.
148
142
149
143
## Examples
150
-
The following example shows how to create a workload group named `newReports`. It uses the Resource Governor default settings and is in the Resource Governor default pool. The example specifies the `default` pool, but this is not required.
144
+
### 1. Shows how to create a workload group named newReports
145
+
It uses the Resource Governor default settings and is in the Resource Governor default pool. The example specifies the `default` pool, but this is not required.
151
146
152
-
```
147
+
```sql
153
148
CREATE WORKLOAD GROUP newReports
154
149
USING "default" ;
155
150
GO
@@ -163,5 +158,3 @@ GO
163
158
[DROP RESOURCE POOL (Transact-SQL)](../../t-sql/statements/drop-resource-pool-transact-sql.md)
0 commit comments