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
title: "Change the database compatibility level and use the Query Store"
2
+
title: "Change the Database Compatibility Level and Use the Query Store"
3
3
description: This article explains the place of using the Query Store to establish a baseline and changing the database compatibility level in a SQL Server upgrade.
In [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)] and later, some changes are only enabled once the [database compatibility level](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md) has been changed. This was done for several reasons:
20
+
In [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)] and later, some changes are only enabled once the [database compatibility level](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md) has been changed. This was done for several reasons:
21
21
22
22
- Since upgrade is a one-way operation (it isn't possible to downgrade the file format), there's value in separating the enablement of new features to a separate operation within the database. It's possible to revert a setting to a prior database compatibility level. The new model reduces the number of things that must happen during an outage window.
23
23
24
-
- Changes to the query processor can have complex effects. Even though a "good" change to the system may be great for most workloads - it may cause an unacceptable regression on an important query for others. Separating this logic from the upgrade process, allows for features such as the Query Store, to mitigate plan choice regressions quickly or even avoid them completely in production servers.
24
+
- Changes to the query processor can have complex effects. Even though a "good" change to the system might be great for most workloads, it could cause an unacceptable regression on an important query for others. Separating this logic from the upgrade process allows for features, such as the Query Store, to mitigate plan choice regressions quickly or even avoid them completely in production servers.
25
25
26
-
The below behaviors are expected for [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] when a database is attached or restored, and after an in-place upgrade:
26
+
The following behaviors are expected for [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] when a database is attached or restored, and after an in-place upgrade:
27
27
28
28
- If the compatibility level of a user database was 100 or higher before the upgrade, it remains the same after upgrade.
29
-
- If the compatibility level of a user database was 90 before upgrade, in the upgraded database, the compatibility level is set to 100, which is the lowest supported compatibility level in [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)].
30
-
- The compatibility levels of the `tempdb`, `model`, `msdb` and Resource databases are set to the current compatibility level after upgrade.
29
+
- If the compatibility level of a user database was 90 before upgrade, in the upgraded database, the compatibility level is set to 100, which is the lowest supported compatibility level in [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)].
30
+
- The compatibility levels of the `tempdb`, `model`, `msdb`, and `Resource` databases are set to the current compatibility level after upgrade.
31
31
- The `master` system database retains the compatibility level it had before upgrade.
32
32
33
-
The upgrade process to enable new query processor functionality is related to the post-release servicing model of the product. Some of those fixes are released under [Trace Flag 4199](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf4199). Customers needing fixes can opt in to those fixes without causing unexpected regressions for other customers. The post-release servicing model for query processor hotfixes is documented [here](https://support.microsoft.com/kb/974006). Beginning with [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)], moving to a new compatibility level implies that Trace Flag 4199 is no longer needed, because those fixes are now enabled by default in the latest compatibility level. Therefore, as part of the upgrade process, it's important to validate that 4199 isn't enabled once the upgrade process completes.
33
+
The upgrade process to enable new query processor functionality is related to the post-release servicing model of the product. Some of those fixes are released under [Trace Flag 4199](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md#tf4199). Customers needing fixes can opt in to those fixes without causing unexpected regressions for other customers. The post-release servicing model for query processor hotfixes is documented [here](https://support.microsoft.com/help/974006). Beginning with [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)], moving to a new compatibility level implies that Trace Flag 4199 is no longer needed, because those fixes are now enabled by default in the latest compatibility level. Therefore, as part of the upgrade process, it's important to validate that 4199 isn't enabled once the upgrade process completes.
34
34
35
35
> [!NOTE]
36
36
> Trace Flag 4199 is still needed to enable any new query processor fixes released after RTM, if applicable.
37
37
38
-
The recommended workflow for upgrading the query processor to the latest version of the code is documented in the [Keep performance stability during the upgrade to newer SQL Server section of Query Store Usage Scenarios](../../relational-databases/performance/query-store-usage-scenarios.md#CEUpgrade), as seen below.
38
+
For information about the recommended workflow to upgrade the query processor to the latest version of the code, see [Keep performance stability during the upgrade to newer SQL Server section of Query Store Usage Scenarios](../../relational-databases/performance/query-store-usage-scenarios.md#CEUpgrade).
39
39
40
-
:::image type="content" source="media/change-the-database-compatibility-mode-and-use-the-query-store/query-store-usage.png" alt-text="Diagram showing the recommended workflow for upgrading the query processor to the latest version of the code.":::
40
+
:::image type="content" source="media/change-the-database-compatibility-mode-and-use-the-query-store/query-store-usage.png" alt-text="Diagram showing the recommended workflow for upgrading the query processor to the latest version of the code." lightbox="media/change-the-database-compatibility-mode-and-use-the-query-store/query-store-usage.png":::
41
41
42
-
Starting with [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)]v18, users can be guided through the recommended workflow using the Query Tuning Assistant. For more information, see [Upgrading Databases by using the Query Tuning Assistant](../../relational-databases/performance/upgrade-dbcompat-using-qta.md).
42
+
Starting with [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)]18, users can be guided through the recommended workflow using the Query Tuning Assistant. For more information, see [Upgrade databases using the Query Tuning Assistant](../../relational-databases/performance/upgrade-dbcompat-using-qta.md).
43
43
44
-
## See also
44
+
## Related content
45
45
46
-
-[View or Change the Compatibility Level of a Database](../../relational-databases/databases/view-or-change-the-compatibility-level-of-a-database.md)
46
+
-[View or change the compatibility level of a database](../../relational-databases/databases/view-or-change-the-compatibility-level-of-a-database.md)
47
47
-[Query Store Usage Scenarios](../../relational-databases/performance/query-store-usage-scenarios.md)
[!INCLUDE [SQL Server -Windows Only](../../includes/applies-to-version/sql-windows-only.md)]
27
27
28
-
During [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Setup, the System Configuration Checker (SCC) scans the computer where [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] will be installed. The SCC checks for conditions that prevent a successful [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] installation. Before Setup starts the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Installation Wizard, the SCC retrieves the status of each item. It then compares the result with required conditions and provides guidance for removal of blocking issues.
29
-
30
-
The system configuration checker generates a report which contains a short description for each executed rule, and the execution status. The system configuration check report is located at %programfiles%\Microsoft SQL Server\140\Setup Bootstrap\Log\\\<YYYYMMDD_HHMM>\\\.
31
-
32
-
See the following links for more information:
28
+
During [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Setup, the System Configuration Checker (SCC) scans the computer where [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] will be installed.
33
29
34
-
-[Hardware and Software Requirements for Installing SQL Server](../../sql-server/install/hardware-and-software-requirements-for-installing-sql-server.md)
35
-
-[Security Considerations for a SQL Server Installation](../../sql-server/install/security-considerations-for-a-sql-server-installation.md)
36
-
-[Supported Version and Edition Upgrades](../../database-engine/install-windows/supported-version-and-edition-upgrades.md)
37
-
38
-
30
+
## Remarks
31
+
32
+
The SCC checks for conditions that prevent a successful [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] installation. Before Setup starts the [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Installation Wizard, the SCC retrieves the status of each item. It then compares the result with required conditions and provides guidance for removal of blocking issues.
33
+
34
+
The system configuration checker generates a report which contains a short description for each executed rule, and the execution status. The system configuration check report is located at `%programfiles%\Microsoft SQL Server\140\Setup Bootstrap\Log\<yyyyMMdd_HHmm>`.
35
+
36
+
## Related content
37
+
38
+
-[Hardware and software requirements for SQL Server 2022](../../sql-server/install/hardware-and-software-requirements-for-installing-sql-server-2022.md)
39
+
-[Security considerations for a SQL Server installation](../../sql-server/install/security-considerations-for-a-sql-server-installation.md)
40
+
-[Supported version and edition upgrades (SQL Server 2022)](supported-version-and-edition-upgrades-2022.md)
0 commit comments