Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Intelligent query processing in SQL databases

Feedback

In this article

Applies to:SQL ServerAzure SQL DatabaseAzure SQL Managed InstanceSQL database in Microsoft Fabric

The intelligent query processing (IQP) feature family includes features with broad impact that improve the performance of existing workloads with minimal implementation effort to adopt. The following graphic details the family of IQP features and when they were first introduced for SQL Server. All IQP features are available in Azure SQL Managed Instance and Azure SQL Database. Some features depend on the database's compatibility level.

Diagram representing the features in the intelligent query processing family and when they were introduced in SQL Server.

Watch this video for an overview of intelligent query processing:

 

For demos and sample code of intelligent query processing (IQP) features, see theGitHub sample repository.

You can make workloads automatically eligible for intelligent query processing by enabling the applicable database compatibility level for the database. You can set this using Transact-SQL. For example:

ALTER DATABASE [WideWorldImportersDW]    SET COMPATIBILITY_LEVEL = 170;

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, seeIntelligent query processing features in detail.

IQP features for Azure SQL Database and SQL Server 2025

IQP FeatureSupported in Azure SQL DatabaseSupported in SQL Server 2025 (17.x)Description
Optional parameter plan optimization (OPPO)Yes, starting with database compatibility level 170Yes, starting with SQL Server 2025 (17.x) with database compatibility level 170Leverages the adaptive plan optimization (Multiplan) infrastructure that was introduced with the Parameter Sensitive Plan Optimization (PSPO) improvement, which generates multiple plans from a single statement. The feature can choose a more optimal plan at runtime based on whether a parameter isNULL OR NOT NULL, which improves performance for queries that could otherwise default to suboptimal performance for such query patterns.
Cardinality estimation (CE) feedback for expressionsYes, starting with database compatibility level 170Yes, starting with SQL Server 2025 (17.x) with database compatibility level 160Extends CE feedback to improve cardinality estimates for repeating expressions across queries by learning from previous executions and automatically applying appropriate CE model choices to future executions of those expressions.
OPTIMIZED_SP_EXECUTESQLYesYes, starting with SQL Server 2025 (17.x)Effectively reduce the impact of compilation storms. A compilation storm is a situation where a large number of queries is being compiled simultaneously, leading to performance issues and resource contention. Enable this feature to allow invocations ofsp_executesql to behave like objects such as stored procedures and triggers from a compilation perspective.

IQP features for Azure SQL Database and SQL Server 2022

IQP FeatureSupported in Azure SQL DatabaseSupported in SQL Server 2022 (16.x) and later versionsDescription
Adaptive Joins (Batch Mode)Yes, starting with database compatibility level 140Yes, starting in SQL Server 2017 (14.x) with database compatibility level 140Adaptive joins dynamically select a join type during runtime based on actual input rows.
Approximate Count DistinctYesYes, starting in SQL Server 2019 (15.x)Provide approximateCOUNT DISTINCT for big data scenarios with the benefit of high performance and a low memory footprint.
Approximate PercentileYes, starting with database compatibility level 110Yes, starting in SQL Server 2022 (16.x) with compatibility level 110Quickly compute percentiles for a large dataset with acceptable rank-based error bounds to help make rapid decisions by using approximate percentile aggregate functions.
Batch Mode on RowstoreYes, starting with database compatibility level 150Yes, starting in SQL Server 2019 (15.x) with compatibility level 150Provide batch mode for CPU-bound relational DW workloads without requiring columnstore indexes.
Cardinality estimation (CE) feedbackYes, starting with database compatibility level 160Yes, starting in SQL Server 2022 (16.x) with compatibility level 160Automatically 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.
Degree of parallelism (DOP) feedbackYes, starting with database compatibility level 160Yes, starting with database compatibility level 160Automatically adjusts degree of parallelism for repeating queries to optimize for workloads where inefficient parallelism can cause performance issues. Requires Query Store to be enabled.
Interleaved ExecutionYes, starting with database compatibility level 140Yes, starting in SQL Server 2017 (14.x) with database compatibility level 140Uses the actual cardinality of the multi-statement table valued function encountered on first compilation instead of a fixed guess.
Memory grant feedback (Batch Mode)Yes, starting with database compatibility level 140Yes, starting in SQL Server 2017 (14.x) with database compatibility level 140If 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.
Memory grant feedback (Row Mode)Yes, starting with database compatibility level 150Yes, starting in SQL Server 2019 (15.x) with database compatibility level 150If 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.
Memory grant feedback (Percentile)Yes, enabled on all databasesYes, starting with SQL Server 2022 (16.x)) with database compatibility level 140Addresses existing limitations of memory grant feedback in a non-intrusive way by incorporating past query execution to refine feedback.
Memory Grant feedback persistenceYes, enabled on all databasesYes, starting with SQL Server 2022 (16.x)) with database compatibility level 140Provides new functionality to persist memory grant feedback. Requires Query Store to be enabled for the database and inREAD_WRITE mode.
CE feedback persistenceYes, starting with database compatibility level 160Yes, starting with SQL Server 2022 (16.x)) with database compatibility level 160Requires Query Store to be enabled for the database and inREAD_WRITE mode.
Optimized plan forcing with Query StoreYesYes, starting with SQL Server 2022 (16.x)).Reduces compilation overhead for repeating forced queries. For more information, seeOptimized plan forcing with Query Store.
Scalar UDF InliningYes, starting with database compatibility level 150Yes, starting in SQL Server 2019 (15.x) with database compatibility level 150Scalar UDFs are transformed into equivalent relational expressions that are "inlined" into the calling query, often resulting in significant performance gains.
Parameter Sensitive Plan optimizationYes, starting with database compatibility level 160Yes, starting in SQL Server 2022 (16.x) with database compatibility level 160Parameter Sensitive Plan optimization addresses the scenario where a single cached plan for a parameterized query isn't optimal for all possible incoming parameter values, for example non-uniform data distributions.
Table Variable Deferred CompilationYes, starting with database compatibility level 150Yes, starting in SQL Server 2019 (15.x) with database compatibility level 150Uses the actual cardinality of the table variable encountered on first compilation instead of a fixed guess.

IQP features for Azure SQL Managed Instance

IQP FeatureSupported in Azure SQL Managed InstanceDescription
Adaptive Joins (Batch Mode)Yes, starting with database compatibility level 140Adaptive joins dynamically select a join type during runtime based on actual input rows.
Approximate Count DistinctYesProvide approximateCOUNT DISTINCT for big data scenarios with the benefit of high performance and a low memory footprint.
Approximate PercentileYes, starting with database compatibility level 110Quickly compute percentiles for a large dataset with acceptable rank-based error bounds to help make rapid decisions by using approximate percentile aggregate functions.
Batch Mode on RowstoreYes, starting with database compatibility level 150Provide batch mode for CPU-bound relational DW workloads without requiring columnstore indexes.
Cardinality estimation (CE) feedbackYes, starting with database compatibility level 160Automatically 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.
Cardinality estimation (CE) feedback for expressionsYes, starting with database compatibility level 160 in Azure SQL Managed Instance, with theSQL Server 2025 orAlways-up-to-dateupdate policy. No, for theSQL Server 2022 update policy.Extends CE feedback to improve cardinality estimates for repeating expressions across queries by learning from previous executions and automatically applying appropriate CE model choices to future executions of those expressions.
Degree of parallelism (DOP) feedbackYes, starting with database compatibility level 160 in Azure SQL Managed Instance with theSQL Server 2025 orAlways-up-to-dateupdate policy. No, for theSQL Server 2022 update policy.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.
Interleaved ExecutionYes, starting with database compatibility level 140Uses the actual cardinality of the multi-statement table valued function encountered on first compilation instead of a fixed guess.
Memory grant feedback (Batch Mode)Yes, starting with database compatibility level 140If 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.
Memory grant feedback (Row Mode)Yes, starting with database compatibility level 150If 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.
Memory grant feedback (Percentile)Yes, starting with database compatibility level 160Addresses existing limitations of memory grant feedback in a non-intrusive way by incorporating past query execution to refine feedback.
Memory Grant, CE, and DOP feedback persistenceYes, starting with database compatibility level 160Provides new functionality to persist memory grant feedback. CE and DOP feedback is always persisted. Requires Query Store to be enabled for the database and inREAD_WRITE mode.
Optimized plan forcing with Query StoreNoReduces compilation overhead for repeating forced queries. For more information, seeOptimized plan forcing with Query Store.
Scalar UDF InliningYes, starting with database compatibility level 150Scalar UDFs are transformed into equivalent relational expressions that are "inlined" into the calling query, often resulting in significant performance gains.
Parameter Sensitive Plan optimizationYes, starting with database compatibility level 160Parameter Sensitivity Plan Optimization addresses the scenario where a single cached plan for a parameterized query isn't optimal for all possible incoming parameter values, for example non-uniform data distributions.
Table Variable Deferred CompilationYes, starting with database compatibility level 150Uses the actual cardinality of the table variable encountered on first compilation instead of a fixed guess.

IQP features for SQL Server 2019

IQP featureSupported in SQL Server 2019 (15.x)Description
Adaptive Joins (Batch Mode)Yes, starting in SQL Server 2017 (14.x) with database compatibility level 140Adaptive joins dynamically select a join type during runtime based on actual input rows.
Approximate Count DistinctYesProvide approximateCOUNT DISTINCT for big data scenarios with the benefit of high performance and a low memory footprint.
Batch Mode on RowstoreYes, starting with database compatibility level 150Provide batch mode for CPU-bound relational DW workloads without requiring columnstore indexes.
Interleaved ExecutionYes, starting with database compatibility level 140Use the actual cardinality of the multi-statement table valued function encountered on first compilation instead of a fixed guess.
Memory grant feedback (Batch Mode)Yes, starting with database compatibility level 140If 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.
Memory grant feedback (Row Mode)Yes, starting with database compatibility level 150If 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.
Scalar UDF InliningYes, starting with database compatibility level 150Scalar UDFs are transformed into equivalent relational expressions that are "inlined" into the calling query, often resulting in significant performance gains.
Table Variable Deferred CompilationYes, starting with database compatibility level 150Use the actual cardinality of the table variable encountered on first compilation instead of a fixed guess.

IQP features for SQL Server 2017

IQP featureSupported in SQL Server 2017 (14.x)Description
Adaptive Joins (Batch Mode)Yes, starting in SQL Server 2017 (14.x) with database compatibility level 140Adaptive joins dynamically select a join type during runtime based on actual input rows.
Approximate Count DistinctYesProvide approximateCOUNT DISTINCT for big data scenarios with the benefit of high performance and a low memory footprint.
Interleaved ExecutionYes, starting with database compatibility level 140Use the actual cardinality of the multi-statement table valued function encountered on first compilation instead of a fixed guess.
Memory grant feedback (Batch Mode)Yes, starting with database compatibility level 140If 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.

Query Store requirement

Several of the suite ofintelligent query processing features require theQuery Store to be enabled in order to benefit the user database. To enable the Query Store, seeEnable the Query Store.

IQP featureRequires Query Store to be enabled andREAD_WRITE
Adaptive Joins (Batch Mode)No
Approximate Count DistinctNo
Approximate PercentileNo
Batch Mode on RowstoreNo
Cardinality estimation (CE) feedbackYes
Degree of parallelism (DOP) feedbackYes
Interleaved ExecutionNo
Memory grant feedback (Batch Mode)No
Memory grant feedback (Row Mode)No
Memory grant feedback (Percentile and Persistence mode)Yes
Optimized plan forcing with Query StoreYes
Scalar UDF InliningNo
Parameter Sensitive Plan optimizationNo, but recommended
Table Variable Deferred CompilationNo

Related content


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?