QUERY_OPTIMIZER_HOTFIXES
Enable optimizer fixes shipped in cumulative updates, which are off by default.
- Padrão
OFF- Range
- ON, OFF, PRIMARY (secondary only)
- Restart needed
- Não
- Default checked on
- SQL Server 2025
O que faz
Optimizer fixes that change plans ship disabled so a CU cannot silently change plans. This is the database-level equivalent of trace flag 4199.
Valor padrão
OFF. OFF (SQL Server 2025).
Check the current value
-- run in the database you want to check SELECT name, value, value_for_secondary, is_value_default FROM sys.database_scoped_configurations WHERE name = 'QUERY_OPTIMIZER_HOTFIXES';
Change it
-- run in the database to change ALTER DATABASE SCOPED CONFIGURATION SET QUERY_OPTIMIZER_HOTFIXES = ON;
No restart. It applies to the current database, to queries compiled after the change; run it in each database that needs it.
When to change it
When a known optimizer bug fixed in a CU affects your queries, or as a deliberate policy tested with Query Store.
What can go wrong
Plans may change on the next CU.
Questions about QUERY_OPTIMIZER_HOTFIXES
What is the default value of QUERY_OPTIMIZER_HOTFIXES in SQL Server?
OFF. OFF (SQL Server 2025).
Does changing QUERY_OPTIMIZER_HOTFIXES require a restart?
No. No restart. It applies to the current database, to queries compiled after the change; run it in each database that needs it.
When should I change QUERY_OPTIMIZER_HOTFIXES?
When a known optimizer bug fixed in a CU affects your queries, or as a deliberate policy tested with Query Store.
Back to all SQL Server settings, or check the SQL Server manual for every option.
Check QUERY_OPTIMIZER_HOTFIXES on your own server
SQLly runs the query above against SQL Server and the other engines in this reference, from one desktop app on macOS, Windows and Linux.