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 da2aacb
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/relational-databases/performance/intelligent-query-processing-feedback.md
+14-11Lines changed: 14 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn about query processing feedback features, part of the Intelli
4
4
author: WilliamDAssafMSFT
5
5
ms.author: wiassaf
6
6
ms.reviewer: katsmith
7
-
ms.date: 05/02/2023
7
+
ms.date: 06/08/2023
8
8
ms.service: sql
9
9
ms.subservice: configuration
10
10
ms.topic: conceptual
@@ -173,6 +173,7 @@ Values surfaced in this attribute are as follows:
173
173
| No: Accurate Grant | If there's no spill to disk and the statement uses at least 50% of the granted memory, then memory grant feedback isn't triggered. |
174
174
| No: Feedback disabled | If memory grant feedback is continually triggered and fluctuates between memory-increase and memory-decrease operations, the database engine will disable memory grant feedback for the statement. |
175
175
| Yes: Adjusting | Memory grant feedback has been applied and may be further adjusted for the next execution. |
176
+
| Yes: Percentile Adjusting | Memory grant feedback is being applied using the percentile grant algorithm, which looks at more history than only the most recent execution. |
176
177
| Yes: Stable | Memory grant feedback has been applied and granted memory is now stable, meaning that what was last granted for the previous execution is what was granted for the current execution. |
177
178
178
179
#### Disable row mode memory grant feedback without changing the compatibility level
@@ -201,14 +202,14 @@ A USE HINT query hint takes precedence over a [database scoped configuration](..
201
202
202
203
### Percentile and persistence mode memory grant feedback
203
204
204
-
**Applies to:**[!INCLUDE[sssql22-md](../../includes/sssql22-md.md)] and later
205
+
**Applies to:**[!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], [!INCLUDE[sssql22-md](../../includes/sssql22-md.md)] and later
205
206
206
-
This feature was introduced in [!INCLUDE[ssSQL22](../../includes/sssql22-md.md)], however this performance enhancement is available for queries that operate in the database compatibility level 140 (introduced in SQL Server 2017) or higher, or the QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_n hint of 140 and higher, and when Query Store is enabled for the database and is in a "read write" state.
207
+
This feature was introduced in [!INCLUDE[ssSQL22](../../includes/sssql22-md.md)], however this performance enhancement is available for queries that operate in the database compatibility level 140 (introduced in SQL Server 2017) or higher, or the `QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_n` hint of 140 and higher, and when Query Store is enabled for the database and is in a "read write" state.
207
208
208
-
- Percentile memory grant feedback is enabled by default in [!INCLUDE[ssSQL22](../../includes/sssql22-md.md)], but has no effect if when Query Store is not enabled and in a "read write" state.
209
-
- Persistence for memory grant, CE, and DOP feedback is on by default in [!INCLUDE[ssSQL22](../../includes/sssql22-md.md)], but has no effect if when Query Store is not enabled and in a "read write" state.
210
-
- Percentile memory grant feedback is not currently available in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], and [!INCLUDE[ssazuremi_md](../../includes/ssazuremi_md.md)].
211
-
-Persistence is not currently available in[!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)] and[!INCLUDE[ssazuremi_md](../../includes/ssazuremi_md.md)].
209
+
- Percentile memory grant feedback is enabled by default in [!INCLUDE[ssSQL22](../../includes/sssql22-md.md)], but has no effect if Query Store is not enabled or when Query Store is not in a "read write" state.
210
+
- Persistence for memory grant, CE, and DOP feedback is on by default in [!INCLUDE[ssSQL22](../../includes/sssql22-md.md)], but has no effect when Query Store is not enabled or when Query Store is not in a "read write" state.
211
+
- Percentile and persistence for memory grant feedback is available in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], and enabled by default on all databases, both existing and new.
212
+
-Percentile and persistence for memory grant feedback is not currently available in [!INCLUDE[ssazuremi_md](../../includes/ssazuremi_md.md)].
212
213
213
214
It's recommended that you have a performance baseline for your workload before the feature is enabled for your database. The baseline numbers will help you determine if you're getting the intended benefit from the feature.
214
215
@@ -230,19 +231,21 @@ Persistence also applies to [DOP feedback](#degree-of-parallelism-dop-feedback)
230
231
231
232
#### Enable memory grant feedback: persistence and percentile
232
233
233
-
To enable memory grant feedback persistence and percentile, use database compatibility level 140 or higher for the database you're connected to when executing the query. Persistence and percentile feedback are [enabled by default](#percentile-and-persistence-mode-memory-grant-feedback).
234
+
Persistence and percentile feedback are [enabled by default](#percentile-and-persistence-mode-memory-grant-feedback) in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)] and [!INCLUDE[ssSQL22](../../includes/sssql22-md.md)].
235
+
236
+
Use database compatibility level 140 or higher for the database you're connected to when executing the query. You can change this via [ALTER DATABASE](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md):
234
237
235
238
`ALTER DATABASE <DATABASE NAME> SET COMPATIBILITY LEVEL = 140; -- OR HIGHER`
236
239
237
-
The Query Store must be enabled for every database where the persistence portion of this feature is used.
240
+
The Query Store must be enabled for every database where the persistence portion of this feature is used.
238
241
239
242
#### Disable percentile
240
243
241
244
To disable memory grant feedback percentile for all query executions originating from the database, execute the following within the context of the applicable database:
242
245
243
246
`ALTER DATABASE SCOPED CONFIGURATION SET MEMORY_GRANT_FEEDBACK_PERCENTILE = OFF;`
244
247
245
-
The default setting for `MEMORY_GRANT_FEEDBACK_PERCENTILE` is `OFF`.
248
+
The default setting for `MEMORY_GRANT_FEEDBACK_PERCENTILE` is `ON`.
246
249
247
250
#### Disable persistence
248
251
@@ -258,7 +261,7 @@ The default setting for `MEMORY_GRANT_FEEDBACK_PERSISTENCE` is `ON`.
258
261
259
262
#### Considerations for memory grant feedback
260
263
261
-
You can view your current settings by querying `sys.database_scoped_configurations`.
264
+
You can view your current settings by querying [sys.database_scoped_configurations](../system-catalog-views/sys-database-scoped-configurations-transact-sql.md).
262
265
263
266
> [!NOTE]
264
267
> That this feature won't work if both `BATCH_MODE_MEMORY_GRANT_FEEDBACK` and `ROW_MODE_MEMORY_GRANT_FEEDBACK` are set to OFF.
Copy file name to clipboardExpand all lines: docs/relational-databases/performance/intelligent-query-processing.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: "Intelligent query processing features to improve query performance
4
4
author: "MikeRayMSFT"
5
5
ms.author: "mikeray"
6
6
ms.reviewer: "wiassaf"
7
-
ms.date: 10/12/2022
7
+
ms.date: 06/08/2023
8
8
ms.service: sql
9
9
ms.subservice: performance
10
10
ms.topic: conceptual
@@ -33,9 +33,9 @@ ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;
33
33
34
34
The following table details all intelligent query processing features, along with any requirement they have for database compatibility level. For complete details on all IQP features, including release notes and more in-depth descriptions, see [Intelligent query processing (IQP) feature details](intelligent-query-processing-details.md).
35
35
36
-
## <aid="sql2022"></a> IQP features for [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)], [!INCLUDE[ssSDSMIfull](../../includes/sssdsmifull-md.md)],[!INCLUDE[sssql22-md](../../includes/sssql22-md.md)]
36
+
## <aid="sql2022"></a> IQP features for [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)] and[!INCLUDE[sssql22-md](../../includes/sssql22-md.md)]
37
37
38
-
|**IQP Feature**|**Supported in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)]and [!INCLUDE[ssSDSMIfull](../../includes/sssdsmifull-md.md)]**|**Supported in [!INCLUDE[sssql22-md](../../includes/sssql22-md.md)]**|**Description**|
38
+
|**IQP Feature**|**Supported in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)]|**Supported in [!INCLUDE[sssql22-md](../../includes/sssql22-md.md)]**|**Description**|
|[Adaptive Joins (Batch Mode)](intelligent-query-processing-details.md#batch-mode-adaptive-joins)| Yes, starting with database compatibility level 140| Yes, starting in [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] with database compatibility level 140|Adaptive joins dynamically select a join type during runtime based on actual input rows.|
41
41
|[Approximate Count Distinct](intelligent-query-processing-details.md#approximate-query-processing)| Yes| Yes, starting in [!INCLUDE[sql-server-2019](../../includes/sssql19-md.md)]|Provide approximate COUNT DISTINCT for big data scenarios with the benefit of high performance and a low memory footprint. |
@@ -47,14 +47,35 @@ The following table details all intelligent query processing features, along wit
47
47
|[Memory grant feedback (Batch Mode)](intelligent-query-processing-feedback.md#batch-mode-memory-grant-feedback)| Yes, starting with database compatibility level 140| Yes, starting in [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] with database compatibility level 140|If a batch mode query has operations that spill to disk, add more memory for consecutive executions. If a query wastes > 50% of the memory allocated to it, reduce the memory grant size for consecutive executions.|
48
48
|[Memory grant feedback (Row Mode)](intelligent-query-processing-feedback.md#row-mode-memory-grant-feedback)| Yes, starting with database compatibility level 150| Yes, starting in [!INCLUDE[sql-server-2019](../../includes/sssql19-md.md)] with database compatibility level 150|If a row mode query has operations that spill to disk, add more memory for consecutive executions. If a query wastes > 50% of the memory allocated to it, reduce the memory grant size for consecutive executions.|
49
49
|[Memory grant feedback (Percentile)](intelligent-query-processing-feedback.md#percentile-and-persistence-mode-memory-grant-feedback)| No <!--Yes, starting with database compatibility level 160-->| Yes, starting with [!INCLUDE[sql-server-2022](../../includes/sssql22-md.md)]) with database compatibility level 140 | Addresses existing limitations of memory grant feedback in a non-intrusive way by incorporating past query execution to refine feedback. |
50
-
|[Memory Grant, CE, and DOP feedback persistence](intelligent-query-processing-feedback.md#percentile-and-persistence-mode-memory-grant-feedback)| No <!--Yes, starting with database compatibility level 160-->| Yes, starting with [!INCLUDE[sql-server-2022](../../includes/sssql22-md.md)]) with database compatibility level 140 | Provides new functionality to persist memory grant feedback. CE and DOP feedback is always persisted. Requires Query Store to be enabled for the database and in READ_WRITE mode. |
50
+
|[Memory Grant feedback persistence](intelligent-query-processing-feedback.md#percentile-and-persistence-mode-memory-grant-feedback)| Yes, enabled on all databases | Yes, starting with [!INCLUDE[sql-server-2022](../../includes/sssql22-md.md)]) with database compatibility level 140 | Provides new functionality to persist memory grant feedback. Requires Query Store to be enabled for the database and in READ_WRITE mode. |
51
+
|[CE and DOP feedback persistence](intelligent-query-processing-feedback.md#percentile-and-persistence-mode-memory-grant-feedback)| No <!--Yes, starting with database compatibility level 160-->| Yes, starting with [!INCLUDE[sql-server-2022](../../includes/sssql22-md.md)]) with database compatibility level 140 | Requires Query Store to be enabled for the database and in READ_WRITE mode. |
51
52
|[Optimized plan forcing](optimized-plan-forcing-query-store.md)| No <!--Yes, starting with database compatibility level 160-->| Yes, starting with [!INCLUDE[sql-server-2022](../../includes/sssql22-md.md)]). | Reduces compilation overhead for repeating forced queries. For more information, see [Optimized plan forcing with Query Store](optimized-plan-forcing-query-store.md). |
52
53
|[Scalar UDF Inlining](intelligent-query-processing-details.md#scalar-udf-inlining)| Yes, starting with database compatibility level 150 | Yes, starting in [!INCLUDE[sql-server-2019](../../includes/sssql19-md.md)] with database compatibility level 150|Scalar UDFs are transformed into equivalent relational expressions that are "inlined" into the calling query, often resulting in significant performance gains.|
53
54
|[Parameter Sensitivity Plan Optimization](./parameter-sensitive-plan-optimization.md)| No <!--Yes, starting with database compatibility level 160-->| Yes, (Starting in [!INCLUDE[sql-server-2022](../../includes/sssql22-md.md)]) with database compatibility level 160 | Parameter Sensitivity Plan Optimization addresses the scenario where a single cached plan for a parameterized query is not optimal for all possible incoming parameter values, for example non-uniform data distributions. |
54
55
|[Table Variable Deferred Compilation](intelligent-query-processing-details.md#table-variable-deferred-compilation)| Yes, starting with database compatibility level 150 | Yes, starting in [!INCLUDE[sql-server-2019](../../includes/sssql19-md.md)] with database compatibility level 150 | Uses the actual cardinality of the table variable encountered on first compilation instead of a fixed guess.|
55
56
56
57
*[DOP Feedback](intelligent-query-processing-feedback.md#degree-of-parallelism-dop-feedback) is currently available in [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)] as a limited preview. For more information and how to apply for the preview, see [Announcing Degree of Parallelism Feedback Limited Preview](https://techcommunity.microsoft.com/t5/azure-sql-blog/announcing-degree-of-parallelism-feedback-limited-preview/ba-p/3806924).
57
58
59
+
## <aid="sqlmi"></a> IQP features for [!INCLUDE[ssSDSMIfull](../../includes/sssdsmifull-md.md)]
60
+
61
+
|**IQP Feature**|**Supported in [!INCLUDE[ssSDSMIfull](../../includes/sssdsmifull-md.md)]**|**Description**|
|[Adaptive Joins (Batch Mode)](intelligent-query-processing-details.md#batch-mode-adaptive-joins)| Yes, starting with database compatibility level 140 | Adaptive joins dynamically select a join type during runtime based on actual input rows.|
64
+
|[Approximate Count Distinct](intelligent-query-processing-details.md#approximate-query-processing)| Yes| Provide approximate COUNT DISTINCT for big data scenarios with the benefit of high performance and a low memory footprint. |
65
+
|[Approximate Percentile](intelligent-query-processing-details.md#approximate-query-processing)| Yes, starting with database compatibility level 110 | Quickly compute percentiles for a large dataset with acceptable rank-based error bounds to help make rapid decisions by using approximate percentile aggregate functions.|
66
+
|[Batch Mode on Rowstore](intelligent-query-processing-details.md#batch-mode-on-rowstore)| Yes, starting with database compatibility level 150| Yes, starting in [!INCLUDE[sql-server-2019](../../includes/sssql19-md.md)] with compatibility level 150|Provide batch mode for CPU-bound relational DW workloads without requiring columnstore indexes. |
67
+
|[Cardinality estimation (CE) feedback](intelligent-query-processing-feedback.md#cardinality-estimation-ce-feedback)| No <!--Yes, in Preview, starting with database compatibility level 160 -->| Automatically adjusts cardinality estimates for repeating queries to optimize workloads where inefficient CE assumptions cause poor query performance. CE feedback will identify and use a model assumption that better fits a given query and data distribution to improve query execution plan quality. |
68
+
|[Degrees of Parallelism (DOP) feedback](intelligent-query-processing-feedback.md#degree-of-parallelism-dop-feedback)| Yes, starting with database compatibility level 160. | Automatically adjusts degree of parallelism for repeating queries to optimize for workloads where inefficient parallelism can cause performance issues. Requires Query Store to be enabled.|
69
+
|[Interleaved Execution](intelligent-query-processing-details.md#interleaved-execution-for-mstvfs)| Yes, starting with database compatibility level 140 | Uses the actual cardinality of the multi-statement table valued function encountered on first compilation instead of a fixed guess.|
70
+
|[Memory grant feedback (Batch Mode)](intelligent-query-processing-feedback.md#batch-mode-memory-grant-feedback)| Yes, starting with database compatibility level 140 | If a batch mode query has operations that spill to disk, add more memory for consecutive executions. If a query wastes > 50% of the memory allocated to it, reduce the memory grant size for consecutive executions.|
71
+
|[Memory grant feedback (Row Mode)](intelligent-query-processing-feedback.md#row-mode-memory-grant-feedback)| Yes, starting with database compatibility level 150 | If a row mode query has operations that spill to disk, add more memory for consecutive executions. If a query wastes > 50% of the memory allocated to it, reduce the memory grant size for consecutive executions.|
72
+
|[Memory grant feedback (Percentile)](intelligent-query-processing-feedback.md#percentile-and-persistence-mode-memory-grant-feedback)| No <!--Yes, starting with database compatibility level 160-->| Addresses existing limitations of memory grant feedback in a non-intrusive way by incorporating past query execution to refine feedback. |
73
+
|[Memory Grant, CE, and DOP feedback persistence](intelligent-query-processing-feedback.md#percentile-and-persistence-mode-memory-grant-feedback)| No <!--Yes, starting with database compatibility level 160-->| Provides new functionality to persist memory grant feedback. CE and DOP feedback is always persisted. Requires Query Store to be enabled for the database and in READ_WRITE mode. |
74
+
|[Optimized plan forcing](optimized-plan-forcing-query-store.md)| No <!--Yes, starting with database compatibility level 160-->| Reduces compilation overhead for repeating forced queries. For more information, see [Optimized plan forcing with Query Store](optimized-plan-forcing-query-store.md). |
75
+
|[Scalar UDF Inlining](intelligent-query-processing-details.md#scalar-udf-inlining)| Yes, starting with database compatibility level 150 | Scalar UDFs are transformed into equivalent relational expressions that are "inlined" into the calling query, often resulting in significant performance gains.|
76
+
|[Parameter Sensitivity Plan Optimization](./parameter-sensitive-plan-optimization.md)| No <!--Yes, starting with database compatibility level 160-->| Parameter Sensitivity Plan Optimization addresses the scenario where a single cached plan for a parameterized query is not optimal for all possible incoming parameter values, for example non-uniform data distributions. |
77
+
|[Table Variable Deferred Compilation](intelligent-query-processing-details.md#table-variable-deferred-compilation)| Yes, starting with database compatibility level 150 | Uses the actual cardinality of the table variable encountered on first compilation instead of a fixed guess.|
78
+
58
79
## <aid="sql2019"></a> IQP features for [!INCLUDE[sssql19-md](../../includes/sssql19-md.md)]
59
80
60
81
|**IQP Feature**|**Supported in [!INCLUDE[sssql19-md](../../includes/sssql19-md.md)]**|**Description**|
0 commit comments