Detailed list of all discovered (documented and undocumented) Microsoft SQL Server trace flags (605 trace flags).
⚠ REMEMBER: Be extremely careful with trace flags, test in your development environment first. And consult professionals first if you are the slightest uncertain about the effects of your changes.
⚠ Some trace flags were introduced in specific SQL Server versions. For more information on the applicable version, see the Microsoft Support article associated with a specific trace flag.
⚠ Trace flag behavior may not be supported in future releases of SQL Server.
⚠ Azure SQL Database Managed Instance supports the following global Trace Flags: 460, 2301, 2389, 2390, 2453, 2467, 7471, 8207, 9389, 10316 and 11024. Session trace-flags are not yet supported in Managed Instance.
⚠ When specifying a trace flag with the -T
option, use an uppercase "T" to pass the trace flag number.
A lowercase "t" is accepted by SQL Server, but this sets other internal trace flags that are required only by SQL Server support engineers.
(Parameters specified in the Control Panel startup window are not read.)
Headers:
Source links:
Great thanks to:
Trace Flags are settings that in some way or another alters the behavior of various SQL Server functions: Docs Trace Flags
Trace flags are used to set specific server characteristics or to alter a particular behavior. For example, trace flag 3226 is a commonly used startup trace flag which suppresses successful backup messages in the error log. Trace flags are frequently used to diagnose performance issues or to debug stored procedures or complex computer systems, but they may also be recommended by Microsoft Support to address behavior that is negatively impacting a specific workload. All documented trace flags and those recommended by Microsoft Support are fully supported in a production environment when used as directed. Note that trace flags in this list may have additional considerations regarding their particular usage, so it is advisable to carefully review all the recommendations given here and/or by your support engineer. Also, as with any configuration change in SQL Server, it is always best to thoroughly test the flag in a non-production environment before deploying.
-T
option, use an uppercase "T"
to pass the trace flag number. A lowercase "t"
is accepted by SQL Server, but this sets other internal trace flags that are required only by SQL Server support engineers. (Parameters specified in the Control Panel startup window are not read.)From SSMS 16 every sql plan content information about trace flags in section Trace flags
.
You can use the DBCC TRACESTATUS command.
The following example displays the status of all trace flags that are currently enabled globally:
DBCC TRACESTATUS(-1);
GO
The following example displays the status of trace flags 2528 and 3205:
DBCC TRACESTATUS (2528, 3205);
GO
The following example displays whether trace flag 3205 is enabled globally:
DBCC TRACESTATUS (3205, -1);
GO
The following example lists all the trace flags that are enabled for the current session:
DBCC TRACESTATUS ();
GO
We all know that every time SQL Server executes a query it builds an execution plan that translates the logical operations like joins and predicates into physical operations that are implemented in the SQL Server source code. That conversion is based on certain rules known as the Optimizer Rules. They define for example how to perform an INNER JOIN. When we write a simple select statement with an inner join, the query optimizer chooses based on statistics, indexes and enabled rules if the join is executed as a Merge Join, Nested Loop or a Hash Join and also if the join can use the commutative property of joins. Mathematically A join B is equal to B join A, but the computational cost generally is not the same.
To obtain the list of rules of your version of SQL Server we must use the undocumented DBCC commands SHOWONRULES and SHOWOFFRULES. Those commands display the enabled and disabled rules for the whole instance respectively. As you may guess, the number of rules varies amongst versions.
USE master;
GO
DBCC TRACEON(3604);
GO
DBCC SHOWONRULES;
GO
DBCC SHOWOFFRULES;
GO
Rule Name | Description |
---|---|
JNtoNL | Join to Nested Loop |
JNtoHS | Join to Hash |
JNtoSM | Join to Sort Merge |
LOJNtoNL | Left Outer Join to Nested Loop |
LSJNtoHS | Left Semi Join to Hash |
LASJNtoSM | Left Anti Semi Join to Sort Merge |
There are three scopes at which trace flags can work: query, session, and global.
Some flags can only be enabled as global, and some can be enabled at either global or session scope.
⚠ Some USE HINT
hints may conflict with trace flags enabled at the global or session level, or database scoped configuration settings. In this case, the query level hint (USE HINT
) always takes precedence. If a USE HINT
conflicts with another query hint, or a trace flag enabled at the query level (such as by [QUERYTRACEON]), SQL Server will generate an error when trying to execute the query.
The following rules apply:
-T
command line option. This ensures the trace flag remains active after a server restart. Restart SQL Server for the trace flag to take effect.Trace flags are set ON
or OFF
by using either of the following methods:
DBCC TRACEON
with the -1
argument: DBCC TRACEON (2528, -1)
. The effect of enabling a global trace flag with DBCC TRACEON
is lost on server restart. To turn off a global trace flag, use DBCC TRACEOFF
with the -1
argument.-T
startup option to specify that the trace flag be set on during startup.
The -T
startup option enables a trace flag globally. You cannot enable a session-level trace flag by using a startup option. This ensures the trace flag remains active after a server restart. For more information about startup options, see Database Engine Service Startup Options.QUERYTRACEON
trace_flag_number
is duplicated with different trace flag numbers.
Executing a query with the QUERYTRACEON option requires membership in the sysadmin fixed server role.
The QUERYTRACEON option can be used in Plan Guides.Use the DBCC TRACESTATUS command to determine which trace flags are currently active.
List of Unknown trace flags enabled on default Azure SQL Server instances, see more details here: Azure SQL DB Managed Instances: Trace Flags, Ahoy! If you know behavior some of them please open an issue or contact me (taranov.pro).
Trace Flag 272 prevents identity gap after restarting SQL Server 2012 instance, critical for columns with identity and tinyint
and smallint
data types.
(Demo for repeating this issue here)
Trace Flag 460 Replace error message 8152 with 2628 (String or binary data would be truncated. The statement has been terminated.
).
Description for 2628 message has useful information - which column had the truncation and which row.
Trace flag 1118 addresses contention that can exist on a particular type of page in a database, the SGAM page.
This trace flag typically provides benefit for customers that make heavy use of the tempdb system database.
In SQL Server 2016, you change this behavior using the MIXED_PAGE_ALLOCATION
database option, and there is no need for TF 1118.
Trace flag 3023 is used to enable the CHECKSUM option, by default, for all backups taken on an instance.
With this option enabled, page checksums are validated during a backup, and a checksum for the entire backup is generated.
Starting in SQL Server 2014, this option can be set instance-wide through sp_configure ('backup checksum default')
.
Trace flag 3226 prevents the writing of successful backup messages to the SQL Server ERRORLOG.
Information about successful backups is still written to msdb
and can be queried using T-SQL.
For servers with multiple databases and regular transaction log backups, enabling this option means the ERRORLOG is no longer bloated with BACKUP DATABASE and Database backed up messages.
As a DBA, this is a good thing because when I look in my ERRORLOG, I really only want to see errors, I don’t want to scroll through hundreds or thousands of entries about successful backups.
Trace flag 3427 Another change in SQL Server 2016 behavior that could impact tempdb-heavy workloads has to do with Common Criteria Compliance (CCC), also known as C2 auditing. We introduced functionality to allow for transaction-level auditing in CCC which can cause some additional overhead, particularly in workloads that do heavy inserts and updates in temp tables. Unfortunately, this overhead is incurred whether you have CCC enabled or not. In SQL Server 2016 you can enable trace flag 3427 to bypass this overhead starting with SP1 CU2. Starting in SQL Server 2017 CU4, we automatically bypass this code if CCC is disabled.
Trace flag 3449 (and you are on SQL Server 2012 SP3 CU3 or later or SQL Server 2014 SP1 CU7 or later), will get much better performance by avoiding a FlushCache call in a number of different common scenarios, such as backup database, backup transaction log, create database, add a file to a database, restore a transaction log, recover a database, shrink a database file, and a SQL Server “graceful” shutdown.
Trace flag 6534 enables performance improvement of query operations with spatial data types in SQL Server 2012, SQL Server 2014 and SQL Server 2016. The performance gain will vary, depending on the configuration, the types of queries, and the objects.
Trace flag 7412 enables the lightweight query execution statistics profiling infrastructure. Unless your server is already CPU bound, like you’re running all the time with 95% CPU, unless you are at that point, turn on this trace flag at any server you have. This would be my advice here because this enables that lightweight profiling infrastructure there and then you’ll see in a few minutes what it unleashes here. So one thing that happens when I enable the lightweight profiling is that the sys.dm_exec_query_profiles DMV, which is something that actually populates the live query stats ability or feature of SSMS, now also is also populated with this lightweight profiling, which means that for all essence, we are now able to run a live query stats on all fashions at any given point in time, and this is extremely useful for let’s say a production DBA that someone calls and says, “Hey, you have a problem. To tap into running system and look at what it’s doing.”
Trace flag 7745 forces Query Store to not flush data to disk on database shutdown. Using this trace may cause Query Store data not previously flushed to disk to be lost in case of shutdown. For a SQL Server shutdown, the command SHUTDOWN WITH NOWAIT can be used instead of this trace flag to force an immediate shutdown.
Trace Flag: 7752 enables asynchronous load of Query Store. Use this trace flag if SQL Server is experiencing high number of QDS_LOADDB waits related to Query Store synchronous load (default behavior).
Trace Flag: 7806 enables a dedicated administrator connection (DAC) on SQL Server Express.
Trace Flag: 8099 enables a spinlock contention fix for high-end systems running SQL Server 2019 (15.x) serving many concurrent users.
Summary: 605 trace flags
Function: Sets trace flags for all client connections, rather than for a single client connection.
Because trace flags set using the -T command-line option automatically apply to all connections, this trace flag is used only when setting trace flags using DBCC TRACEON and DBCC TRACEOFF.
Link: http://www.sql-server-performance.com/2002/traceflags/
Function: Increases the verboseness of the merge replication agent logging.
IMPORTANT: Trace flag 101 can only be enabled for the Replication Merge Agent using the -T
option when executing replmerg.exe
from the command prompt.
WARNING: Trace flag 101 is not meant to be enabled continuously in a production environment, but only for time-limited troubleshooting purposes.
Link: https://support.microsoft.com/help/2892633
Scope: Replication Merge Agent only
Function: Increases the verboseness of the merge replication agent logging and directs it to the <Distribution server>..msmerge_history
table.
IMPORTANT: Trace flag 102 can only be enabled for the pReplication Merge Agent[ using the -T
option when executing replmerg.exe
from the command prompt.
WARNING: Trace flag 102 is not meant to be enabled continuously in a production environment, but only for time-limited troubleshooting purposes.
Link: https://support.microsoft.com/help/2892633
Scope: Replication Merge Agent only
Undocumented trace flag
Function: Join more than 16 tables in SQL server 6.5
Link: SQL Server 6.5: Some Useful Trace Flag
Function: If you are using Web Synchronization, you can start Replmerg.exe and pass the -T 106 option to use trace flag 106.
This enables you to see the messages that are sent to and from the Publisher.
The agent writes the client's input messages to a file that is named ExchangeID(guid).IN.XML, and writes the output messages to a file that is named ExchangeID(guid).OUT.XML.
(In these file names, guid is the GUID of the Exchange Server session.)
These files are created in the directory from which Replmerg.exe was invoked.
For security, you should delete these files after you are finished.
Link: http://technet.microsoft.com/en-us/library/ms151872(v=sql.105).aspx
Undocumented trace flag
Function: SQL 6.5/7/8 – Interprets numbers with a decimal point as float instead of decimal
Link: None
Undocumented trace flag
Function: SQL 6.5 – Turns off ANSI select characteristics
Link: None
Undocumented trace flag
Function: FIX: Error message when you schedule a Replication Merge Agent job to run after you install SQL Server 2000 Service Pack 4: "The process could not enumerate changes at the 'Subscriber'"
Link: None
Function: Forces correct conversion semantics in the scope of DBCC check commands like DBCC CHECKDB, DBCC CHECKTABLE and DBCC CHECKCONSTRAINTS, when analyzing the improved precision and conversion logic introduced with compatibility level 130 for specific data types, on a database that has a lower compatibility level.
Note: This trace flag applies to SQL Server 2016 RTM CU3, SQL Server 2016 SP1 and higher builds.
WARNING: Trace flag 139 is not meant to be enabled continuously in a production environment, and should be used for the sole purpose of performing database validation checks described in this Microsoft Support article.
It should be immediately disabled after validation checks are completed.
Link: https://support.microsoft.com/help/4010261
Link: Docs Trace Flags
Scope: global only
Function: Force server side bucketization.
For legacy applications where change to client side code is not an option and
when the application has queries that are improperly parameterized, this trace flag forces server side bucketization.
Link: http://blogs.msdn.microsoft.com/sqlprogrammability/2007/01/13/6-0-best-programming-practices
Undocumented trace flag
Function: Consider using when replaying against SQL 8.0, to avoid an attempt to set an encrypted connection.
Link: None
Undocumented trace flag
Function: Unclear. Observable effect was to change the identifier for act1008 to act1009 in a query plan.
Link: New Undocumented Trace Flags
Scope: ?
Function: Bugfix in ORDER BY. This hotfix introduces trace flag 168. After you apply this hotfix, you must enable trace flag 168.
Trace flag 168 must be set before the database is migrated to SQL Server 2005.
If trace flag 168 is set after the database is migrated, the query result will remain unsorted.
Link: https://support.microsoft.com/help/926292
Function: Increases the SQL Server Database Engine plan cache bucket count from 40,009 to 160,001 on 64-bit systems.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: https://support.microsoft.com/help/3026083/
Link: Docs Trace Flags
Link: SQL Server Plan Cache Limits
Link: KB2964518
Scope: global only
Function: Enables a fix to address errors when rebuilding partitions online for tables that contain a computed partitioning column.
Link: https://support.microsoft.com/help/3213683/
Link: https://support.microsoft.com/help/4541096/
Link: Docs Trace Flags
Scope: global or session
Function: SQL 6.5 – Backward compatibility switch that enables non-ansi standard behavior. E.g. previously SQL server ignored trailing blanks in the like statement and allowed queries that contained aggregated functions to have items in the group by clause that were not in the select list.
Link: https://support.microsoft.com/help/153096/fix-sql-server-6.5-service-pack-1-fixlist
Function: Reports to the error log when a statistics-dependent stored procedure is being recompiled as a result of auto-update statistics.
Link: https://support.microsoft.com/help/195565
Link: Docs Trace Flags
Scope: global only
Undocumented trace flag
Function: SQL 6.5 – Provides backward compatibility for the set user statement. KB 160732
Link: None
Undocumented trace flag
Function: SET QUOTED IDENTIFIER ON
Link: None
Function: SQL 9 – Error when you run a query against a view: "An error occurred while executing batch"
Link: https://support.microsoft.com/help/945892
Undocumented trace flag
Function: SQL 9 – Query may run much slower when compared to SQL 8 when you use a cursor to run the query
Link: None
Undocumented trace flag
Function: “FIX: Error Message: "Insufficient key column information for updating" Occurs in SQL Server 2000 SP3”
Link: None
Undocumented trace flag
Function: “FIX: The query runs slower than you expected when you try to parse a query in SQL Server 2000”
Link: None
Undocumented trace flag
Function: “FIX: Each query takes a long time to compile when you execute a single query or when you execute multiple concurrent queries in SQL Server 2000”
Link: None
Undocumented trace flag
Function: Tells SQL Server to use correlated sub-queries in Non-ANSI standard backward compatibility mode
Link: None
Undocumented trace flag
Function: Provides backward compatibility for correlated subqueries where non-ANSI-standard results are desired
Link: None
Undocumented trace flag
Function: Provides backward compatibility for nullability behavior. When set, SQL Server has the same nullability violation behavior as that of a ver 4.2: Processing of the entire batch is terminated if the nullability error (inserting NULL into a NOT NULL field) can be detected at compile time; Processing of offending row is skipped, but the command continues if the nullability violation is detected at run time.Behavior of SQL Server is now more consistent because nullability checks are made at run time and a nullability violation results in the command terminating and the batch or transaction process continuing.
Link: None
Undocumented trace flag
Function: Disables checking for allowed interim constraint violations. By default, SQL Server checks for and allows interim constraint violations. An interim constraint violation is caused by a change that removes the violation such that the constraint is met, all within a single statement and transaction. SQL Server checks for interim constraint violations for self-referencing DELETE statements, INSERT, and multi-row UPDATE statements. This checking requires more work tables. With this trace flag you can disallow interim constraint violations, thus requiring fewer work tables.
Link: None
Undocumented trace flag
Function: Derived or NULL columns must be explicitly named in a select…INTO or create view statement when not done they raise an error. This flag avoids that.
Link: None
Undocumented trace flag
Function: Prevents ad-hoc query plans to stay in cache
Link: http://www.sqlservercentral.com/Forums/Topic837613-146-1.aspx
Undocumented trace flag
Function: Will invoke a print algorithm on the XML output before returning it to make the XML result more readable
Link: None
Function: Prints versioning information about extended stored procedure dynamic-link libraries (DLLs).
When SQL Server is started with the trace flag -T260
or if a user with system administrator privileges runs DBCC TRACEON (260)
, and if the extended stored procedure DLL does not support __GetXpVersion()
, a warning message (Error 8131: Extended stored procedure DLL '%' does not export __GetXpVersion().
) is printed to the error log. (Note that __GetXpVersion()
begins with two underscores.)
Link: https://docs.microsoft.com/en-us/sql/relational-databases/extended-stored-procedures-programming/creating-extended-stored-procedures
Link: Docs Trace Flags
Scope: global or session
Undocumented trace flag
Function: SQL 7 – Trailing spaces are no longer truncated from literal strings in CASE statements
Link: None
Note: Recommended for SQL Server 2012
Function: Disabling the identity cache. It prevents identity gap after restarting SQL Server 2012 instance, critical for columns with identity and tinyint and smallint data types.
Link: http://www.big.info/2013/01/how-to-solve-sql-server-2012-identity.html
Link: https://web.archive.org/web/20160822054721/https://connect.microsoft.com/SQLServer/feedback/details/739013/failover-or-restart-results-in-reseed-of-identity
Link: https://dbafromthecold.com/2017/05/24/disabling-the-identity-cache-in-sql-server-2017/
Link: Demo
Link: https://stackoverflow.com/q/14146148/2298061
Scope: global only
Undocumented trace flag
Function: “FIX: Error message when you insert a new row into a view in SQL Server 2005: Cannot insert explicit value for identity column in table
Link: None
Undocumented trace flag
Function: Output Index Selection info
Link: SQL Server 6.5: Some Useful Trace Flag
Undocumented trace flag
Function: Changed the reported CachedPlanSize.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Outputs info about actual join order
Link: SQL Server 6.5: Some Useful Trace Flag
Undocumented trace flag
Function: Disables join-order heuristics used in ANSI joins. To see join-order heuristics use flag 310. SQL Server uses join-order heuristics to reduce of permutations when using the best join order.
Link: None
Function: Outputs detailed info about updates
Link: SQL Server 6.5: Some Useful Trace Flag
Link: https://support.microsoft.com/help/153096/fix-sql-server-6.5-service-pack-1-fixlist
Undocumented trace flag
Function: Prints information about the cost of using a non-clustered index or a sort to process an ORDER BY clause
Link: None
Undocumented trace flag
Function: Prints information about estimated & actual costs of sorts. Instructs server to use arithmetic averaging when calculating density instead of a geometric weighted average when updating statistics. Useful for building better stats when an index has skew on the leading column. Use only for updating the stats of a table/index with known skewed data.
Link: None
Undocumented trace flag
Function: Enables full output when using the SET SHOWPLAN_ALL option, which gives detailed information about joins
Link: None
Undocumented trace flag
Function: Disables the costing of pseudo-merge joins, thus significantly reducing time spent on the parse for certain types of large, multi-table joins. One can also use SET FORCEPLAN ON to disable the costing of pseudo-merge joins because the query is forced to use the order specified in the FROM clause.
Link: None
Undocumented trace flag
Function: Changes join order selection logic in SQL Server 6.5
Link: SQL Server 6.5: Some Useful Trace Flag
Undocumented trace flag
Function: Prints ”compile issued” message in the errorlog for each compiled statement, when used together with 3605
Link: None
Function: Replace error message ID 8152 with message ID 2628 (String or binary data would be truncated. The statement has been terminated.
).
Description for 2628 message has useful information - which column had the truncation and which row.
Starting with SQL Server 2019 (15.x) CTP 2.4, to accomplish this at the database level, see the VERBOSE_TRUNCATION_WARNINGS
option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).
Note: This trace flag applies to SQL Server 2017 (14.x) CU12 and higher builds.
Note: Starting with database compatibility level 150, message ID 2628 is the default and this trace flag has no effect.
Note: Don’t leave this trace flag enabled on global scope for SQL Server 2017 CU12 and CU13.
There’s at least one bug on SQL Server 2017 CU13: table variables will throw errors saying their contents are being truncated even when no data is going into them.**
Link: Docs Trace Flags
Link: https://www.procuresql.com/blog/2018/09/26/string-or-binary-data-get-truncated/
Link: https://feedback.azure.com/forums/908035-sql-server/suggestions/32908417-binary-or-string-data-would-be-truncated-error
Link: https://blogs.msdn.microsoft.com/sql_server_team/string-or-binary-data-would-be-truncated-replacing-the-infamous-error-8152/
Link: https://support.microsoft.com/help/4468101
Link: https://www.brentozar.com/archive/2019/03/how-to-fix-the-error-string-or-binary-data-would-be-truncated/
Link: https://feedback.azure.com/forums/908035-sql-server/suggestions/36311467-traceflag-460-causing-truncation-errors-on-code-pa
Link: https://support.microsoft.com/help/4490142
Scope: global or session
SQL Server Version: >= 2017 CU12, >= 2016 SP2 CU6
Demo: https://github.com/ktaranov/sqlserver-kit/blob/master/Scripts/Trace_Flag/Trace_Flag_460.sql
Undocumented trace flag
Function: Enforces SQL-92 standards regarding null values for comparisons between variables and parameters. Any comparison of variables and parameters that contain a NULL always results in a NULL.
Link: None
Function: Controls minimally logged inserts into indexed tables.
This trace flag is not required starting SQL Server 2016 as minimal logging is turned on by default for indexed tables.
In SQL Server 2016, when the bulk load operation causes a new page to be allocated, all of the rows sequentially filling that new page are minimally logged if all the other pre-requisites for minimal logging are met.
Rows inserted into existing pages (no new page allocation) to maintain index order are still fully logged, as are rows that are moved as a result of page splits during the load.
It is also important to have ALLOW_PAGE_LOCKS
turned ON
for indexes (which is ON
by default) for minimal logging operation to work as page locks are acquired during allocation and thereby only page or extent allocations are logged.
Link: http://msdn.microsoft.com/en-us/library/dd425070%28v=SQL.100%29.aspx
Link: https://www.pythian.com/blog/minimally-logged-operations-data-loads/
Link: https://msdn.microsoft.com/library/dd425070.aspx
Link: Docs Trace Flags
Link: https://orderbyselectnull.com/2017/07/10/trace-flag-610-and-sql-server-2016/
Scope: global or session
Undocumented trace flag
Function: SQL 9 – When turned on, each lock escalation is recorded in the error log along with the SQL Server handle number.
Aaron confirmed this still works in SQL 2014. Outputs info of the form: "Escalated locks - Reason: LOCK_THRESHOLD, Mode: S, Granularity: TABLE, Table: 222623836,
HoBt: 150:256, HoBt Lock Count: 6248, Escalated Lock Count: 6249, Line Number: 1, Start Offset: 0, SQL Statement: select count(*) from dbo.BigTable"
Link: None
Function: SQL 9 – When turned on, each lock escalation is recorded in the error log along with the SQL Server handle number.
As long as there are no SCH_M lock requests waiting in the ‘lock wait list’,
the ‘lock wait list’ will be bypassed by statements issued in uncommitted read transaction isolation level.
If there is a SCH_M lock request in the ‘lock wait list’, a query in uncommitted read transaction isolation level
will not bypass the ‘lock wait list’, but the SCH_S lock request will go into the ‘lock wait list’.
In order behind the SCH_M lock waiting in the same list. As a result the grant of the SCH_S request for such a query
is dependent on the grant and release of the SCH_M lock request entering the ‘lock wait list’ earlier.
Link: https://blogs.msdn.microsoft.com/saponsqlserver/2014/01/17/new-functionality-in-sql-server-2014-part-3-low-priority-wait/
Function: Disables the background columnstore compression task. SQL Server periodically runs the Tuple Mover background task that compresses columnstore index rowgroups with uncompressed data, one such rowgroup at a time.
Columnstore compression improves query performance but also consumes system resources.
You can control the timing of columnstore compression manually, by disabling the background compression task with trace flag 634, and then explicitly invoking ALTER INDEX REORGANIZE or ALTER INDEX REBUILD at the time of your choice.
Link: Niko Neugebauer Columnstore Indexes – part 35
Link: Docs Trace Flags
Link: http://www.sqlservergeeks.com/trace-flag-634-disable-background-columnstore-compression/
Scope: global only
Undocumented trace flag
Function: Serves for getting detailed information on which Columnstore were eliminated by the Query Optimiser right into the error log.
Link: Niko Neugebauer Columnstore Indexes – part 35
Link: http://www.sqlskills.com/blogs/joe/exploring-columnstore-index-metadata-segment-distribution-and-elimination-behaviors
Scope: global or session
Function: Avoids a new-in-SQL 2012 data check (done when adding a column to a table) that can cause ALTER TABLE... ADD
Link: https://support.microsoft.com/help/2986423/fix-it-takes-a-long-time-to-add-new-columns-to-a-table-when-the-row-size-exceeds-the-maximum-allowed-size
Function: Disable page pre-fetching scans.
If you turn on trace flag 652, SQL Server no longer brings database pages into the buffer pool before these database pages are consumed by the scans.
If you turn on trace flag 652, queries that benefit from the page pre-fetching feature exhibit low performance.
Link: KB920093
Link: Docs Trace Flags
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-652/
Scope: global or session
Undocumented trace flag
Function: Disables read ahead for the current connection
Link: None
Function: Disables the ghost record removal process. A ghost record is the result of a delete operation.
When you delete a record, the deleted record is kept as a ghost record. Later, the deleted record is purged by the ghost record removal process.
When you disable this process, the deleted record is not purged. Therefore, the space that the deleted record consumes is not freed.
This behavior affects space consumption and the performance of scan operations.
Link: KB920093
Link: Docs Trace Flags
Link: Let’s talk about trace flags
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-661/
Scope: global or session
Undocumented trace flag
Function: Prints detailed information about the work done by the ghost cleanup task when it runs next.
Use TF 3605 to see the output in the errorlog
Link: http://blogs.msdn.com/b/sqljourney/archive/2012/07/28/an-in-depth-look-at-ghost-records-in-sql-server.aspx
Function: “...prevents user queries from queuing requests to the ghost cleanup process”. This flag is a workaround for stack dumps occurring right after SQL Server startup, where user queries (that queue pages for ghost cleanup) were running so quickly after SQL startup that they were queuing pages before the ghost cleanup process had actually initialized.
Link: https://support.microsoft.com/help/3027860/error-17066-or-17310-during-sql-server-startup
Undocumented trace flag
Function: According to the KB, used to workaround a bug in SQL 2000 SP3 by reverting to pre-SP3 parallel-scan behavior in parallel queries. Database-Wiki.com: “Disallow row counter and column mod counters to be partitioned”
Link: None
Function: Disables fast inserts while bulk loading data into heap or clustered index.
Starting SQL Server 2016, fast inserts is enabled by default leveraging minimal logging when database is in simple or bulk logged recovery model to optimize insert performance for records inserted into new pages.
With fast inserts, each bulk load batch acquires new extent(s) bypassing the allocation lookup for existing extent with available free space to optimize insert performance.
With fast inserts, bulk loads with small batch sizes can lead to increased unused space consumed by objects hence it is recommended to use large batch size for each batch to fill the extent completely.
If increasing batch size is not feasible, this trace flag can help reduce unused space reserved at the expense of performance.
Note: This trace flag applies to SQL Server 2016 (13.x) RTM and higher builds.
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/sql_server_team/sql-server-2016-minimal-logging-and-impact-of-the-batchsize-in-bulk-load-operations/
Scope: global or session
Undocumented trace flag
Function: SQL 9 – Performance of INSERT operations against a table with an identity column may be slow when compared to SQL 8
Link: None
Undocumented trace flag
Function: Turn off transaction logging for the entire SQL dataserver
Link: None
Undocumented trace flag
Function: Disables deferred deallocation. But note Paul White’s comment on the post! The flag # may actuall by 671.
Link: Controlling SQL Server memory dumps
Function: Enables table lock for bulk load operations into a heap with no non-clustered indexes.
When this trace flag is enabled, bulk load operations acquire bulk update (BU) locks when bulk copying data into a table.
Bulk update (BU) locks allow multiple threads to bulk load data concurrently into the same table, while preventing other processes that are not bulk loading data from accessing the table.
The behavior is similar to when the user explicitly specifies TABLOCK
hint while performing bulk load, or when the sp_tableoption
table lock on bulk load is enabled for a given table.
However, when this trace flag is enabled, this behavior becomes default without any query or database changes.
Link: Docs Trace Flags
Scope: global or session
Function: enables DBCC audit checks to be performed on pages to test for logical consistency problems.
These checks try to detect when a read operation from a disk does not experience any errors but the read operation returns data that is not valid.
Pages will be audited every time that they are read from disk.
Page auditing can affect performance and should only be used in systems where data stability is in question.
Link: http://technet.microsoft.com/en-au/library/cc917726.aspx
Link: http://www.sqlskills.com/blogs/paul/how-to-tell-if-the-io-subsystem-is-causing-corruptions
Link: Important Trace Flags That Every DBA Should Know
Link: https://technet.microsoft.com/en-au/library/cc917726.aspx
Scope: ?
Undocumented trace flag
Function: SQL 8 – Limits the amount of Lazy write activity
Link: None
Function: SQL 8/9 – Enables latch enforcement. SQL Server 8 (with service pack 4) and SQL Server 9 can perform latch enforcement for data pages found in the buffer pool cache. Latch enforcement changes the virtual memory protection state while database page status changes from "clean" to "dirty" ("dirty" means modified through INSERT, UPDATE or DELETE operation). If an attempt is made to modify a data page while latch enforcement is set, it causes an exception and creates a mini-dump in SQL Server installation's LOG directory. Microsoft support can examine the contents of such mini-dump to determine the cause of the exception. In order to modify the data page the connection must first acquire a modification latch. Once the data modification latch is acquired the page protection is changed to read-write. Once the modification latch is released the page protection changes back to read-only.
Link: https://technet.microsoft.com/en-us/library/cc966500.aspx
Link: https://blogs.msdn.microsoft.com/psssql/2012/11/12/how-can-reference-counting-be-a-leading-memory-scribbler-cause
Function: Enables additional I/O diagnostics to check for Lost Write or Stale Read conditions during file I/O operations.
Trace flag 818 enables an in-memory ring buffer that is used for tracking the last 2,048 successful write operations that are performed by SQL Server, not including sort and workfile I/Os.
When errors such as Error 605, 823, or 3448 occur, the incoming buffer's log sequence number (LSN) value is compared to the recent write list.
If the LSN that is retrieved is older than the one specified during the write operation, a new error message is logged in the SQL Server Errorlog.
Link: https://support.microsoft.com/help/826433/
Link: https://technet.microsoft.com/en-us/library/cc966500.aspx
Link: https://support.microsoft.com/help/828339/
Link: Important Trace Flags That Every DBA Should Know
Scope: global only
Undocumented trace flag
Function: A workaround for SQL 2000 over-committing memory on the machine
Link: None
Undocumented trace flag
Function: In SQL 2000, enables Buffer Pool support for NUMA. TF 888 must be used.
Link: None
Function: SQL 8 - When enabled checkpoint ignores the recovery interval target and keeps steady I/O otherwise it uses recovery interval setting as a target for the length of time that checkpoint will take
Link: https://support.microsoft.com/help/906121
Link: https://blogs.msdn.microsoft.com/psssql/2008/04/11/how-it-works-sql-server-checkpoint-flushcache-outstanding-io-target/
Function: SQL 9 – Disable the reporting of CPU Drift errors in the SQL Server errorlog like SQL Server has encountered 2 occurrence(s) of I/O requests taking longer than 15 seconds to complete
Link: https://support.microsoft.com/help/897284
Link: https://technet.microsoft.com/en-us/library/aa175396(v=SQL.80).aspx
Undocumented trace flag
Function: Protect unchanged pages in the buffer pool to catch memory corruptions
Link: None
Undocumented trace flag
Function: Disable superlatches.
Starting with SQL Server 2005, superlatches (also called sublatches) were introduced to improve SQL Server efficiency in highly concurrent OLTP workloads for a certain pattern of usage (i.e. very high shared read only access to the page (SH) while write access is very low or not exists).
Superlatches are used by SQL Server only in NUMA systems with 32+ logical processors.
A Superlatch will behave as a single latch with sublatch structures and there can be one sublatch per partition per logical CPU core.
So when a superlatch is created, the CPU worker thread will just have to acquire the shared (SH) sublatch that is assigned to the scheduler.
This ensures that a shared (SH) superlatch uses less resources while at the same time access to pages is more efficient comparing to non-partitioned shared latches.
The reason for this is that the superlatch do not require any synchronization of the global state as it will access only the local NUMA memory.
Link: https://www.sqlservercentral.com/forums/topic/sql-server-trace-flags-complete-list/page/3/#post-3679021
Scope: global
Function: Uses Microsoft Windows large-page allocations for the buffer pool.
Trace flag 834 causes SQL Server to use Microsoft Windows large-page allocations for the memory that is allocated for the buffer pool.
The page size varies depending on the hardware platform, but the page size may be from 2 MB to 16 MB.
Large pages are allocated at startup and are kept throughout the lifetime of the process.
Trace flag 834 improves performance by increasing the efficiency of the translation look-aside buffer (TLB) in the CPU.
Note: If you are using the Columnstore Index feature of SQL Server 2012 to SQL Server 2016, we do not recommend turning on trace flag 834.
If using SQL Server 2019 (15.x) and columnstore, see trace flag 876 instead.
Link: KB920093
Link: https://support.microsoft.com/help/3210239
Link: Docs Trace Flags
Link: Let’s talk about trace flags
Link: KB2964518
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-834/
Scope: global only
Undocumented trace flag
Function: SQL 9 / 10 – On 64 bit SQL Server it turns off Lock pages in memory
Link: None
Scope: ?
Function: Trace flag 836 causes SQL Server to size the buffer pool at startup based on the value of the max server memory option instead of based on the total physical memory.
You can use trace flag 836 to reduce the number of buffer descriptors that are allocated at startup in 32-bit Address Windowing Extensions (AWE) mode.
Trace flag 836 applies only to 32-bit versions of SQL Server that have the AWE allocation enabled. You can turn on trace flag 836 only at startup.
Link: KB920093
Link: https://blogs.msdn.microsoft.com/psssql/2012/12/11/how-it-works-sql-server-32-bit-paeawe-on-sql-2005-2008-and-2008-r2-not-using-as-much-ram-as-expected/
Scope: global only
Function: (Apparently) forces SQL Server to treate all NUMA memory as “flat”, as if it was SMP.
Link: https://blogs.msdn.microsoft.com/psssql/2010/04/02/how-it-works-soft-numa-io-completion-thread-lazy-writer-workers-and-memory-nodes
Scope: global only
Function: SQL 9 – When trace turned on, SQL Server can perform larger I/O extent reads to populate the buffer pool when SQL Server starts this populates the buffer pool faster. Additionally, the larger I/O extent reads improve the initial query compilation and the response time when SQL Server starts.
Link: https://blogs.msdn.microsoft.com/ialonso/2011/12/09/the-read-ahead-that-doesnt-count-as-read-ahead
Scope: global only
Undocumented trace flag
Function: Use sys.dm_os_memory_node_access_stats to verify local vs. foreign memory under NUMA configurations after turning on this flag
Link: None
Undocumented trace flag
Function: Enable Lock pages in Memory on Standard Edition for SQL Server 2005 and 2008.
Link: https://support.microsoft.com/help/970070
Link: https://support.microsoft.com/help/2708594/fix-locked-page-allocations-are-enabled-without-any-warning-after-you-upgrade-to-sql-server-2012
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-845/
Scope: global only
Function: According to Bob Ward’s PASS 2014 talk on SQL Server IO, “disable[s] BPE even if enabled via ALTER SERVER”
Link: None
Undocumented trace flag
Function: According to the error log this disables buffer pool extension.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: According to the error log this enables buffer pool extension. This TF probably doesn’t do anything anymore.
Link: New Undocumented Trace Flags
Scope: ?
Function: Uses large-page allocations for columnstore.
Turns 8k page allocations for Column Store segments into 2MB instead.
Note: Unlike trace flag 834, using trace flag 876 does not pre-allocate SQLOS memory at instance startup, and unused memory can be released.
Note: This trace flag applies to SQL Server 2019 (15.x) and higher builds.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: Docs Trace Flags
Link: https://twitter.com/slava_oks/status/1044257034361757696
Link: https://github.com/ktaranov/sqlserver-kit/issues/151
Scope: global only
Function: Enables support for locked pages for SQL 2000
Link: None
Function: Bypasses execution of database upgrade script when installing a Cumulative Update or Service Pack.
If you encounter an error during script upgrade mode, it is recommended to contact Microsoft SQL Customer Service and Support (CSS) for further guidance.
Warning: This trace flag is meant for troubleshooting of failed updates during script upgrade mode, and it is not supported to run it continuously in a production environment.
Database upgrade scripts needs to execute successfully for a complete install of Cumulative Updates and Service Packs.
Not doing so can cause unexpected issues with your SQL Server instance.
Link: https://support.microsoft.com/help/2163980
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/luti/2017/05/17/sql-server-offline-after-applying-service-pack/
Link: https://blog.sqlauthority.com/2018/11/06/sql-server-script-level-upgrade-for-database-master-failed-because-upgrade-step-msdb110_upgrade-sql-encountered-error-926-state-1-severity-25/
Scope: global only
Undocumented trace flag
Function: The KB article references the flag in the context of seeing a Profiler dump
Link: None
Function: SQL 9 - Used space in tempdb increases continuously when you run a query that creates internal objects in tempdb
Link: https://support.microsoft.com/help/947204
Link: https://blogs.msdn.microsoft.com/arvindsh/2014/02/24/tracking-tempdb-internal-object-space-usage-in-sql-2012
Function: When a file in the filegroup meets the autogrow threshold, all files in the filegroup grow.
This trace flag affects all databases and is recommended only if every database is safe to be grow all files in a filegroup by the same amount.
Note: Beginning with SQL Server 2016 this behavior is controlled by the AUTOGROW_SINGLE_FILE
and AUTOGROW_ALL_FILES
option of ALTER DATABASE
, and trace flag 1117 has no affect.
For more information, see ALTER DATABASE File and Filegroup Options (Transact-SQL).
Link: https://www.littlekendra.com/2017/01/03/parallelism-and-tempdb-data-file-usage-in-sql-server/
Link: SQL Server 2016 : Getting tempdb a little more right
Link: Docs Trace Flags
Link: http://www.sqlskills.com/blogs/paul/tempdb-configuration-survey-results-and-advice
Link: https://blogs.msdn.microsoft.com/ialonso/2011/12/01/attempt-to-grow-all-files-in-one-filegroup-and-not-just-the-one-next-in-the-autogrowth-chain-using-trace-flag-1117
Link: http://sql-articles.com/articles/general/day-6trace-flag-1117-auto-grow-equally-in-all-data-file
Link: http://www.ryanjadams.com/2017/05/trace-flag-1117-growth-contention/
Link: https://www.sqlskills.com/blogs/paul/misconceptions-around-tf-1118/
Link: KB2964518
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-1117/
Scope: global only
Function: Forces page allocations on uniform extents instead of mixed extents, reducing contention on the SGAM page.
When a new object is created, by default, the first eight pages are allocated from different extents (mixed extents).
Afterwards, when more pages are needed, those are allocated from that same extent (uniform extent).
The SGAM page is used to track these mixed extents, so can quickly become a bottleneck when numerous mixed page allocations are occurring.
This trace flag allocates all eight pages from the same extent when creating new objects, minimizing the need to scan the SGAM page.
Note: Beginning with SQL Server 2016 this behavior is controlled by the SET MIXED_PAGE_ALLOCATION
option of ALTER DATABASE
, and trace flag 1118 has no affect. For more information, see ALTER DATABASE SET Options (Transact-SQL).
Link: http://blogs.msdn.com/b/psssql/archive/2008/12/17/sql-server-2005-and-2008-trace-flag-1118-t1118-usage.aspx
Link: http://www.sqlskills.com/blogs/paul/misconceptions-around-tf-1118/
Link: https://support.microsoft.com/help/328551
Link: SQL Server 2016 : Getting tempdb a little more right
Link: Docs Trace Flags
Link: https://chrisadkin.org/2015/04/14/well-known-and-not-so-well-known-sql-server-tuning-knobs-and-switches
Link: KB2964518
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-1118/
Scope: global only
Function: Turns off mixed extent allocation (Similar to 1118?)
Link: TECHNET List Of SQL Server Trace Flags
Undocumented trace flag
Function: Unknown. Has been reportedly found turned on in some SQL Server instances running Dynamics AX. Also rumored to be invalid in public builds of SQL Server
Link: None
Undocumented trace flag
Function: A workaround for a bug in SQL 2005 SP2, SP3, and SQL 2008, where mixed page allocations climb continually, due to a change in the way that mixed-page allocations are done.
Link: None
Undocumented trace flag
Function: In the Proportional Fill Algorithm, each database data file will be assigned with a ranking integer number to specify how many times this file will be skipped from the writing process to the next file depending on the free space of that file, this number is called the Skip Target where the minimum value equal to 1 means that a write process will be performed on that file.
The Skip Target can be measured by dividing the number of free extents in the file with the largest free space amount by the number of free extents in the current file, as integer value. The larger the free space in the database data file, the smaller Skip Target value.
To have one file to write on each loop, there should be minimum one data file with Skip Target value equal to 1.
Each time a new database data file is added or removed, or 8192 extents is filled in the database filegroup, the Skip Target value will be calculated again. In this way, all database data files will become full approximately at the same time.
The Skip Target calculation can be monitored by enabling the Trace Flag 1165.
Link: https://www.sqlshack.com/understanding-sql-server-proportional-fill-algorithm/
Scope:
Undocumented trace flag
Function: SQL 7 - Forces allocation to use free pages for text or image data and maintain efficiency of storage. Helpful in case when DBCC SHRINKFILE and SHRINKDATABASE commands may not work because of sparsely populated text, ntext, or image columns.
Link: None
Undocumented trace flag
Function: Applies only in the case of SQL 7 – SP3, similar with trace flag 1180
Link: None
Function: Prints detailed lock information as every request for a lock is made (the process ID and type of lock requested)
Link: TECHNET List Of SQL Server Trace Flags
Link: https://blogs.msdn.microsoft.com/sqlserverstorageengine/2008/03/30/tempdb-table-variable-vs-local-temporary-table
Link: KB169960
Link: Important Trace Flags That Every DBA Should Know
Scope: ?
Undocumented trace flag
Function: Insert blocked lock requests into syslocks
Link: None
Function: Returns the resources and types of locks participating in a deadlock and also the current command affected.
Writes information about deadlocks to the ERRORLOG in a "text format".
Trace flag 1204 provides node base information about deadlock in another words you can say that all nodes which are involved in deadlock.
Finally after all nodes information it also provides information about deadlock victim.
Link: https://support.microsoft.com/help/832524
Link: Docs Trace Flags
Link: Important Trace Flags That Every DBA Should Know
Link: https://www.sqlservergeeks.com/sql-server-deadlock-trace-flag-1204/
Scope: global only
Function: More detailed information about the command being executed at the time of a deadlock. Documented in SQL 7 BOL.
Link: https://support.microsoft.com/help/832524/sql-server-technical-bulletin---how-to-resolve-a-deadlock
Function: Used to complement flag 1204 by displaying other locks held by deadlock parties
Link: KB169960
Function: KB: “Prints the host name and program name supplied by the client. This can help identify a client involved in a deadlock, assuming the client specifies a unique value for each connection.”
Link: KB169960
Function: Disables lock escalation based on memory pressure, or based on number of locks. The SQL Server Database Engine will not escalate row or page locks to table locks.
Using this trace flag can generate excessive numbers of locks. This can slow the performance of the Database Engine, or cause 1204 errors (unable to allocate lock resource) because of insufficient memory.
If both trace flag 1211 and 1224 are set, 1211 takes precedence over 1224.
However, because trace flag 1211 prevents escalation in every case, even under memory pressure, we recommend that you use 1224.
This helps avoid "out-of-locks" errors when many locks are being used.
Link: Docs Trace Flags
Link: http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-2330-lock-escalation
Link: Important Trace Flags That Every DBA Should Know
Link: https://support.microsoft.com/help/323630
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-1211/
Scope: global or session
Undocumented trace flag
Function: SQL 7 - Disables Health reporting. Lock monitor when detects a (worker thread) resource level blocking scenario. If a SPID that owns a lock is currently queued to the scheduler, because all the assigned worker threads have been created and all the assigned worker threads are in an un-resolvable wait state, the following error message is written to the SQL Server error log: Error 1223: Process ID %d:%d cannot acquire lock "%s" on resource %s because a potential deadlock exists on Scheduler %d for the resource. Process ID %d:% d holds a lock "%h" on this resource.
Link: None
Undocumented trace flag
Function: Disables (for 7.0) the “UMS Health” reporting messages described in the KB article.
Link: None
Function: Returns the resources and types of locks that are participating in a deadlock and also the current command affected, in an XML format that does not comply with any XSD schema.
Write deadlock information to sql server error log.
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/bartd/2006/09/08/deadlock-troubleshooting-part-1/
Link: https://blog.sqlauthority.com/2017/01/09/sql-server-get-historical-deadlock-information-system-health-extended-events
Link: Important Trace Flags That Every DBA Should Know
Link:
Scope: global only
Function: Disables lock escalation based on the number of locks. However, memory pressure can still activate lock escalation. The Database Engine escalates row or page locks to table (or partition) locks if the amount of memory used by lock objects exceeds one of the following conditions:
LOCK_ESCALATION
option of the ALTER TABLE
statement.Function: Enable lock partitioning.
By default, lock partitioning is enabled when a server has 16 or more CPUs. Otherwise, lock partitioning is disabled.
Trace flag 1228 enables lock partitioning for 2 or more CPUs. Trace flag 1229 disables lock partitioning.
Trace flag 1229 overrides trace flag 1228 if trace flag 1228 is also set.
Lock partitioning is useful on multiple-CPU servers where some tables have very high lock rates.
You can turn on trace flag 1228 and trace flag 1229 only at startup.
Link: Trace Flag 1228 and 1229
Link: Microsoft SQL Server 2005 TPC-C Trace Flags
Scope: global only
Function: Disables all lock partitioning regardless of the number of CPUs.
By default, SQL Server enables lock partitioning when a server has 16 or more CPUs, to improve the scalability characteristics of larger systems.
For more information on lock partitioning, see the Transaction Locking and Row Versioning Guide
WARNING: Trace flag 1229 can cause spinlock contention and poor performance.
Link: Docs Trace Flags
Link: Trace Flag 1228 and 1229
Link: Microsoft SQL Server 2005 TPC-C Trace Flags
Scope: global only
Function: Enables database lock partitioning. Fixes performance problem in scenarios with high lock activity in SQL 2012 and SQL 2014.
Note: Beginning with SQL Server 2012 SP3 and SQL Server 2014 SP1 this behavior is controlled by the engine and trace flag 1236 has no effect.
Link: https://support.microsoft.com/help/2926217
Link: Docs Trace Flags
Link: KB2964518
Scope: global only
Function: Allows the ALTER PARTITION FUNCTION
statement to honor the current user-defined session deadlock priority instead of being the likely deadlock victim by default.
Note: Starting with SQL Server 2017 and database compatibility level 140 this is the default behavior and trace flag 1237 has no effect.
Link: https://support.microsoft.com/help/4025261
Link: Docs Trace Flags
Scope: global or session or query
Function: Disabled mini-dump for non-yield condition.
Disables mini-dump generation for "any of the 17883, 17884, 17887, or 17888 errors.
The trace flag can be used in conjunction with trace flag –T1262. For example, you could enable –T1262
to get 10- and a 60-second interval reporting and also enable –T1260
to avoid getting mini-dumps."
Link: A Topical Collection of SQL Server Flags v6
Link: How To Diagnose and Correct Errors 17883, 17884, 17887, and 17888
Link: Docs Trace Flags
Link: https://www.sqlservergeeks.com/sql-trace-flag-1260/
Scope: global only
Undocumented trace flag
Function: SQL 8 - Disables Health reporting. Lock monitor when detects a (worker thread) resource level blocking scenario. If a SPID that owns a lock is currently queued to the scheduler, because all the assigned worker threads have been created and all the assigned worker threads are in an un-resolvable wait state, the following error message is written to the SQL Server error log: Error 1229: Process ID %d:%d owns resources that are blocking processes on scheduler %d.
Link: None
Function: The default behavior (for 1788* errors) is for SQL to generate a mini-dump on the first occurrence, but never after.
1262 changes the behavior: “When –T1262 is enabled, a mini-dump is generated when the non-yielding condition is declared (15 seconds) and at subsequent 60-second intervals for the same non-yield occurrence.
A new nonDiagCorrect17883etc; yielding occurrence causes dump captures to occur again.”
In SQL 2000 this was a startup-only flag; in 2005+ it can be enabled via TRACEON.
Note that the flag is also covered in Khen2005, p400, but with no new information.
Link: A Topical Collection of SQL Server Flags v6
Link: How To Diagnose and Correct Errors 17883, 17884, 17887, and 17888
Link: https://www.sqlservergeeks.com/sql-trace-flag-1262/
Scope: global or session
Function: Collect process names in non-yielding scenario memory dumps
Link: A Topical Collection of SQL Server Flags v6
Link: https://support.microsoft.com/help/2630458/
Function: SQL 9 RTM – Enables creation of database mirroring endpoint, which is required for setting up and using database mirroring
Link: None
Function: Trace database restart and failover messages to SQL Errorlog for mirrored databases
Link: Trace flags in sql server from trace flag 902 to trace flag 1462
Function: Enables the replication log reader to move forward even if the async secondaries have not acknowledged the reception of a change.
Even with this trace flag enabled the log reader always waits for the sync secondaries. The log reader will not go beyond the min ack of the sync secondaries.
This trace flag applies to the instance of SQL Server, not just an availability group, an availability database, or a log reader instance.
Takes effect immediately without a restart. This trace flag can be activated ahead of time or when an async secondary fails.
Link: Docs Trace Flags
Scope: global only
Function: When you use SNAC to connect to an instance of a principal server in a database mirroring session: "The connection attempted to fail over to a server that does not have a failover partner".
Link: https://support.microsoft.com/help/936179
Function: Disables log stream compression for asynchronous availability groups.
This feature is enabled by default on asynchronous availability groups in order to optimize network bandwidth.
Link: Tune compression for availability group
Link: Docs Trace Flags
Link: http://www.sqlskills.com/blogs/paul/sql-server-2008-performance-boost-for-database-mirroring
Link: http://sqlblog.com/blogs/joe_chang/archive/2014/03/13/hekaton-and-benchmarks.aspx
Scope: global only
Function: Prints information to the Error Log (3605 is not necessary) for a variety of transaction log operations are done, including when the MinLSN value is reset, when a VLF is formatted, etc.
Link: None
Function: Dynamic memory grant expansion can also help with parallel index build plans where the distribution of rows across threads is uneven.
The amount of memory that can be consumed this way is not unlimited, however.
SQL Server checks each time an expansion is needed to see if the request is reasonable given the resources available at that time.
Some insight to this process can be obtained by enabling undocumented trace flag 1504, together with 3604 (for message output to the console)
or 3605 (output to the SQL Server error log). If the index build plan is parallel, only 3605 is effective because parallel workers cannot send trace messages cross-thread to the console.
Link: Internals of the Seven SQL Server Sorts – Part 1
Function: Use standard disk I/O (i.e. turn off asynchronous I/O)
Link: None
Function: Once enabled at start up makes SQL Server output information regarding memory allocation requests
Link: None
Function: Turns on the unpacking and checking of RPC information in Open Data Services. Used only when applications depend on the old behavior.
Link: None
Function: Boot the SQL dataserver with TCP_NODELAY enabled
Link: None
Function: If possible, pin shared memory -- check errorlog for success/failure
Link: None
Function: Set affinity of the SQL data server engine's onto particular CPUs -- usually pins engine 0 to processor 0, engine 1 to processor 1...
Link: None
Function: Khen2005, page 385 (paraphrased): directs SQL to use threads instead of fiber even if the “lightweight pooling” config option is on. (Apparently, sometimes SQL wouldn’t start successfully when using lightweight pooling, and so this lets you get SQL up and running, so that you can turn the config option off)
Link: None
Function: Prints information when a temporary table is created or dropped
Link: None
Function: MSShipped bit will be set automatically at Create time when creating stored procedures
Link: None
Function: Enables SQL Server optimization when disks of different sector sizes are used for primary and secondary replica log files, in SQL Server Always On and Log Shipping environments.
This trace flag is only required to be enabled on SQL Server instances with transaction log file residing on disk with sector size of 512 bytes.
It is not required to be enabled on disk with 4k sector sizes.
Note: This trace flag applies to SQL Server 2012 (11.x) SP1 CU13, SQL Server 2012 (11.x) SP2 CU3, SQL Server 2014 (12.x) RTM CU5, and higher builds.
Link: https://support.microsoft.com/help/3009974
Link: Docs Trace Flags
Scope: global only
Function: SQL 9 - After detaching a database that resides on network-attached storage, you cannot reattach the SQL Server database
Link: https://support.microsoft.com/help/922804
Function: Disable Instant File Initialization.
Used to guarantee the physical data file space acquisition during data file creation or expansion, on a thin provisioned subsystem
Link: http://technet.microsoft.com/en-au/library/cc917726.aspx
Link: https://blogs.msdn.microsoft.com/sql_pfe_blog/2009/12/22/how-and-why-to-enable-instant-file-initialization
Link: http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-330-instant-file-initialization-can-be-controlled-from-within-sql-server
Link: https://support.microsoft.com/help/2574695/file-initialization-takes-a-long-time-for-sql-server-database-related-operations
Link: Important Trace Flags That Every DBA Should Know
Scope: ?
Function: Enable option to have database files on SMB share for SQL Server 2008 and 2008R2
Link: http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive.aspx
Link: https://support.microsoft.com/help/304261/description-of-support-for-network-database-files-in-sql-server
Function: Directs SQL Server to ignore auto-closing databases even if the Auto-close property is set to ON. Must be set globally. Present in Yukon forward
Link: https://blogs.msdn.microsoft.com/ialonso/2012/04/11/want-your-sql-server-to-simply-ignore-the-auto_close-setting-for-all-open-databases-for-which-it-has-been-enabled
Function: Prints the file create/open/close timings
Link: None
Function: Bob Ward briefly references this flag in his PASS 2014 SQL Server IO talk, saying that it “could provide more details around errors” that occur with IO done to SQL data files in Azure Storage.
Link: None
Function: Anecdotally, from a JustDave’s notes on an Amanda Ford talk at SQL Relay Reading 2014: “...disables the automerge functionality for in-memory oltp”
Link: https://justdaveinfo.wordpress.com/2014/10/16/october-13-microsoft-sql-relay-reading
Function: SQL 8 - When you capture a SQL Profiler trace in a file and then you try to import the trace files into tables by using the fn_trace_gettable function no rows may be returned
Link: Note
Function: Unknown
Link: Upgrading an expired SQL Server 2016 Evaluation Edition
Undocumented trace flag
Function: It enables SQL Server to read ETW tracing templates stored in the etwcnf.xml
directory on SQL Server 2008.
When the flag is turned off, the file is not read, and a static in-memory ETW template is used instead.
It is not documented because it can cause SQL Server to hang on startup.
We will be supported by Microsoft running this trace flag as long as we do not experience start up "hangs".
Microsoft recommends using Xevents instead the template file.
Link: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0489f308-2e0c-479f-85a8-9a5661b2462f/trace-flag-1906?forum=sqldatabaseengine
Function: Trace flag 2301 enables advanced optimizations that are specific to decision support queries.
This option applies to decision support processing of large data sets.
Link: KB920093
Link: Docs Trace Flags
Link: http://www.queryprocessor.com/ce_join_base_containment_assumption
Link: https://connect.microsoft.com/SQLServer/feedback/details/772232/make-optimizer-estimations-more-accurate-by-using-metadata
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-2301/
Scope: global or session or query
Function: In SQL 2014, enables output from a 3rd parameter for DBCC SHOW_STATISTICS such that the partial statistics histogram (for just one partition) is shown.
Link: https://sqlperformance.com/2015/05/sql-statistics/incremental-statistics-are-not-used-by-the-query-optimizer
Link: http://blog.dbi-services.com/sql-server-2014-new-incremental-statistics
Function: Sets the query optimizer cardinality estimation model to the SQL Server 2014 (12.x) through SQL Server 2017 versions, dependent of the compatibility level of the database.
Starting with SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'FORCE_DEFAULT_CARDINALITY_ESTIMATION' query hint instead of using this trace flag.
Note: If the database compatibility level is lower than 120, enabling trace flag 2312 uses the cardinality estimation model of SQL Server 2014 (12.x) (120).
Link: KB2801413
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: http://www.sqlservergeeks.com/sql-server-2014-trace-flags-2312/
Link: KB2801413
Scope: global or session or query
Function: Aaron: I stumbled onto this one. Seems to output memory allocations taken during
the compilation process (and maybe the plan as well? “PROCHDR”), as well as
memory broker states & values at the beginning and end of compilation.
Link: None
Function: Aaron: stumbled onto this one as well. I’ve only seen one type of output so far: “Optimization Stage: HEURISTICJOINREORDER”. Maybe useful in combo with other compilation trace flags to see the timing of join reordering?
Link: None
Function: Disables Implied Predicates
Link: https://answers.sqlperformance.com/questions/2299/why-not-seek-predicate.html?utm_content=buffer9bed5&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
Function: SQL 9+ - Makes cardinality estimates upon resulting selectivity. The reasoning for this is that one or more of the constants may be statement parameters, which would change from one execution of the statement to the next.
Link: https://blogs.msdn.microsoft.com/ianjo/2006/03/28/disabling-constant-constant-comparison-estimation
Link: http://www.queryprocessor.ru/isnumeric_ce_bug_eng
Function: Disables “Few Outer Rows” optimization
Link: http://www.queryprocessor.com/few-outer-rows-optimization
Function: Query performance decreases when sys.dm_db_index_usage_stats has large number of rows
Link: http://www.brentozar.com/archive/2015/11/trace-flag-2330-who-needs-missing-index-requests/
Link: https://chrisadkin.org/2015/04/14/well-known-and-not-so-well-known-sql-server-tuning-knobs-and-switches/
Function: PWhite: “Force DML Request Sort (CUpdUtil::FDemandRowsSortedForPerformance)”
Link: Optimizing T-SQL queries that change data
Function: Causes SQL Server to assume a fixed amount of memory is available during query optimization. It does not limit the memory SQL Server grants to execute the query.
The memory configured for SQL Server will still be used by data cache, query execution and other consumers.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: https://www.brentozar.com/archive/2018/08/how-trace-flag-2335-affects-memory-grants/
Link: https://support.microsoft.com/help/2413549
Link: Docs Trace Flags
Link: http://dba.stackexchange.com/questions/53726/difference-in-execution-plans-on-uat-and-prod-server
Link: KB2801413
Scope: global or session or query
Function: Aaron: Another one that I stumbled onto. Appears to tie memory info and cached page likelihoods with costing
Link: None
Function: Causes SQL Server not to use a sort operation (batch sort) for optimized Nested Loops joins when generating a plan.
By default, SQL Server can use an optimized Nested Loops join instead of a full scan or a Nested Loops join with an explicit Sort, when the Query Optimizer concludes that a sort is most likely not required, but still a possibility in the event that the cardinality or cost estimates are incorrect.
Starting with SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'DISABLE_OPTIMIZED_NESTED_LOOP' query hint instead of using this trace flag..
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/psssql/2010/01/11/high-cpu-after-upgrading-to-sql-server-2005-from-2000-due-to-batch-sort
Link: http://www.queryprocessor.com/batch-sort-and-nested-loops
Link: KB2801413
Link: https://www.sqlservergeeks.com/trace-flag-2340/
Scope: global or session or query
Function: Enables the use of a hash join for joins to column store indexes even when the join clause would normally be removed “during query normalization”.
Link: https://support.microsoft.com/help/3146123/query-plan-generation-improvement-for-some-columnstore-queries-in-sql-server-2014-or-2016
Function: TF Selectivity. can be used with the new cardinality estimation model to see the derivation of the distinct estimate on the outer input to an apply, and cardinality estimation in general.
Link: Cardinality Estimation Framework 2014 First Look
Link: http://www.queryprocessor.com/ce-process
Link: https://sqlperformance.com/2014/01/sql-plan/cardinality-estimation-for-multiple-predicates
Link: Nested Loops Joins and Performance Spools
Link: Cardinality Estimation for Multiple Predicates
Scope: session or query
Undocumented trace flag
Function: For one query, this resulted in a parallel plan significantly more expensive than the naturally occurring serial plan. Could be related to trace flag 3651.
Link: New Undocumented Trace Flags
Scope: ?
Function: Changes the fixed update statistics threshold to a linear update statistics threshold.
Change a fixed rate 20% of rows changed for Recompilation Thresholds (RT) on new formula - *SQRT(1000 table rows)
Note: Starting with SQL Server 2016 (13.x) and under the database compatibility level 130 or above, this behavior is controlled by the engine and trace flag 2371 has no effect.**
Link: https://support.microsoft.com/help/2754171
Link: https://blogs.msdn.microsoft.com/saponsqlserver/2011/09/07/changes-to-automatic-update-statistics-in-sql-server-traceflag-2371/
Link: https://blogs.msdn.microsoft.com/axinthefield/sql-server-trace-flag-2371-for-dynamics-ax/
Link: Docs Trace Flags
Link: KB2964518
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-2371/
Link: Temporary Table Caching in Stored Procedures
Scope: global or session
Function: Displays memory utilization during the optimization process. Memory for Phases
Memory before and after deriving properties and rules (verbose)
Link: More Undocumented Query Optimizer Trace Flags
Link: Cardinality Estimation Framework 2014 First Look
Link: Query Optimizer Deep Dive - Part 4
Function: Displays memory utilization during the optimization process. Memory for Deriving Properties.
Link: More Undocumented Query Optimizer Trace Flags
Link: Cardinality Estimation Framework 2014 First Look
Undocumented trace flag
Function: Removes QueryHash and QueryPlanHash information from estimated query plans.
Link: New Undocumented Trace Flags
Scope: ?
Function: SSC: “SQL 8 -Statistics collected for system tables.”
Link: None
Undocumented trace flag
Function: can be used to reduce the CPU cost of reading rows from a lazy index spool.
This flag affects general CPU cost estimates for reading a range of rows from a b-tree.
This flag tends to make index spool selection more likely, for cost reasons.
Link: New Undocumented Trace Flags
Link: Nested Loops Joins and Performance Spools
Scope: ?
Function: Changes the output of DBCC SHOW_STATISTICS.
Instead of the normal Header/Vector/Histogram output, instead we get a single row that gives information related to whether the lead column of the stat object is considered to be ascending or not.
This TF is primarily helpful in watching the state of a stat object change from “Unknown”, to “Ascending” (and potentially to “Stationary”).
Also In SQL Server, if you want to see the information of last four statistics update on a statistics object then you can use trace flag 2388.
In simple words, we can say that this trace flag provide us the historical information about statistics update.
Link: SQL Server - estimates outside of the histogram - half-baked draft
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-2388/
Link: Fun with SQL Server Plan Cache, Trace Flag 8666, and Trace Flag 2388
Scope: session only
Function: Enable automatically generated quick statistics for ascending keys (histogram amendment).
If trace flag 2389 is set, and a leading statistics column is marked as ascending, then the histogram used to estimate cardinality will be adjusted at query compile time.
Note: This trace flag does not apply to CE version 120 or above. Use trace flag 4139 instead.
Link: KB2801413
Link: http://blogs.msdn.com/b/ianjo/archive/2006/04/24/582227.aspx
Link: http://www.sqlmag.com/article/tsql3/making-the-most-of-automatic-statistics-updating--96767
Link: http://sqlperformance.com/2016/07/sql-statistics/trace-flag-2389-new-cardinality-estimator
Link: https://www.sswug.org/sswugresearch/community/trace-flag-2389-and-the-new-cardinality-estimator/
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: SQL Server - estimates outside of the histogram - half-baked draft
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-2389/
Link: KB2801413
Scope: global or session or query
Function: Enable automatically generated quick statistics for ascending or unknown keys (histogram amendment).
If trace flag 2390 is set, and a leading statistics column is marked as ascending or unknown, then the histogram used to estimate cardinality will be adjusted at query compile time
Note: This trace flag does not apply to CE version 120 or above. Use trace flag 4139 instead.
Link: http://blogs.msdn.com/b/ianjo/archive/2006/04/24/582227.aspx
Link: KB2801413
Link: http://www.sqlmag.com/article/tsql3/making-the-most-of-automatic-statistics-updating--96767
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/ianjo/2006/04/24/ascending-keys-and-auto-quick-corrected-statistics
Link: SQL Server - estimates outside of the histogram - half-baked draft
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-2390/
Link: KB2801413
Scope: global or session or query
Undocumented trace flag
Function: Trace Flag 2392 can be used to turn the missing index feature off completely (as a workaround to the issue that is corrected by the hotfix).
This trace flag has been in the product since SQL Server 2005.
The problem is, it will not disable/enable missing index stats collection unless it is enabled at startup.
If you set it as a startup TF and restart SQL Server, then no missing index stats are collected.
If you then subsequently disable TF 2392 while SQL Server is running, it still won’t collect any missing index stats (despite what you may expect).
Link: https://www.sqlskills.com/blogs/glenn/sql-server-missing-indexes-feature-and-trace-flag-2392/
Link: https://support.microsoft.com/help/4042232/fix-access-violation-when-you-cancel-a-pending-query-if-the-missing-in
Scope: global only
Undocumented trace flag
Function: Disable SSC (Smart Seek Costing).
SSC attempts to assess inner side seek I/O cost in more detail, perhaps by considering local ordering and/or the range of values to fetch.
Link: https://dba.stackexchange.com/a/149933/107045
Scope: session or query
Undocumented trace flag
Function: Small changes in operator costs were observed for some queries. These were typically less than 0.01 units.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Disables serial Batch mode processing.
Link: New Undocumented Trace Flags
Scope: ?
Function: Enables the SQL Server Database Engine to abort a request when the maximum time set by Resource Governor REQUEST_MAX_CPU_TIME_SEC configuration is exceeded.
Note: This trace flag applies to SQL Server 2017 CU3 and higher builds.
Link: https://support.microsoft.com/help/4038419
Scope: global only
Function: Fixes performance problem when using large numbers of locks
Link: https://support.microsoft.com/help/2754301
Link: https://support.microsoft.com/help/2746341/fix-high-cpu-usage-when-you-execute-an-update-statement-that-includes-a-where-current-of-cursor-clause-in-sql-server-2008
Function: SQL 10 - Parallel query execution strategy on partitioned tables. SQL 9 used single thread per partition parallel query execution strategy. In SQL 10, multiple threads can be allocated to a single partition by turning on this flag.
Link: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/dc010af9-afa0-4c87-937c-4343b4e1119a/trace-flag-2440
Note: This trace flag applies to SQL Server 2019 preview CTP 2.4 and higher builds.
Function: Enables the equivalent of the last actual execution plan in
sys.dm_exec_query_plan_stats
.
Link: Docs Trace Flags
SQL Server Version: >= 2019 CTP 2.4
Scope: global only
Function: Allow a table variable to trigger recompile when enough number of rows are changed with may allow the query optimizer to choose a more efficient plan.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: http://sqlperformance.com/2014/06/t-sql-queries/table-variable-perf-fix
Link: https://support.microsoft.com/help/2952444
Link: Docs Trace Flags
Link: https://www.brentozar.com/archive/2017/02/using-trace-flag-2453-improve-table-variable-performance
Link: https://www.brentozar.com/archive/2018/03/table-valued-parameters-unexpected-parameter-sniffing
Link: TEMPDB – Files and Trace Flags and Updates
Link: http://www.sqlservergeeks.com/the-correct-cardinality-estimation-for-table-variable-using-trace-flag-2543/
Scope: global or session or query
Function: Relieves RESOURCE_SEMAPHORE_MUTEX contention, which may be primarily due to a bug in SQL 2005.
Link: None
Function: When SQL Server is determining the runtime DOP for a parallel plan, this flag directs it to use logic found in “older versions” (the post doesn’t say which versions) to
determine which NUMA node to place the parallel plan on. This older logic relies on a polling mechanism (roughly every 1 second), and can result in race conditions where 2
parallel plans end up on the same node. The newer logic “significantly reduces” the likelihood of this happening.
Link: https://blogs.msdn.microsoft.com/psssql/2013/09/27/how-it-works-maximizing-max-degree-of-parallelism-maxdop
Function: Enables an alternate parallel worker thread allocation policy, based on which node has the least allocated threads.
For more information, see Parallel Query Processing.
Refer to Configure the max worker threads Server Configuration Option for information on configuring the max worker threads server option.
Note: Query degree of parallelism (DOP) has to fit into a single node for this alternate policy to be used, or the default thread allocation policy is used instead. Using this trace flag, it is not recommended to execute queries specifying a DOP over the number of schedulers in a single node, as this could interfere with queries specifying a DOP below or equal to the number of schedulers in a single node.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/psssql/2013/09/27/how-it-works-maximizing-max-degree-of-parallelism-maxdop
Link: https://erikdarlingdata.com/2019/06/thoughts-on-maxdop/
Link: SQL Server Parallel Query Placement Decision Logic
Scope: global only
Undocumented trace flag
Function: “Find the next node that can service the DOP request. Unlike full mode, the global, resource manager keeps track of the last node used.
Starting from the last position, and moving to the next node, SQL Server checks for query placement opportunities.
If a node can’t support the request SQL Server continues advancing nodes and searching.”
Link: SQL Server Parallel Query Placement Decision Logic
Function: Enables alternate exchange for INSERT INTO ... SELECT
into a partitioned columnstore index.
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/3204769/
Scope: global or session or query
Undocumented trace flag
Function: Fixes performance problem when using AFTER triggers on partitioned tables
Link: https://support.microsoft.com/help/2606883
Undocumented trace flag
Function: When SQL Server is determining the runtime DOP for a parallel plan, this flag directs it to limit the NUMA Node placement for the query to the node that the connection is associated with.
Link: https://blogs.msdn.microsoft.com/psssql/2013/09/27/how-it-works-maximizing-max-degree-of-parallelism-maxdop
Link: SQL Server Parallel Query Placement Decision Logic
Undocumented trace flag
Function: In SQL 2016 (CTP 3.0 at least), enables output for the “query_trace_column_values” Extended Event, allowing the value of output columns from individual plan iterators to be traced.
Link: http://www.queryprocessor.com/query-trace-column-values
Function: SQL 7 - Prevents DBCC TRACEON 208, SPID 10 errors from appearing in the error log (Note: DBCC TRACEON(208) just means “SET QUOTED IDENTIFIER ON”)
Link: None
Undocumented trace flag
Function: Disables parallel non-clustered index checking for DBCC CHECKTABLE
Link: None
Undocumented trace flag
Function: Used with DBCC CHECKTABLE
to see the total count of forward records in a table
Link: None
Undocumented trace flag
Function: Verbose Merge Replication logging to msmerge_history table for troubleshooting Merger repl performance
Link: http://sqlblog.com/blogs/argenis_fernandez/archive/2012/05/29/ghost-records-backups-and-database-compression-with-a-pinch-of-security-considerations.aspx
Undocumented trace flag
Function: For SQL Server prior 2005. Forces DBCC HELP to return syntax of undocumented DBCC statements.
If 2520/2588 is not turned on, DBCC HELP will refuse to give you the syntax stating: "No help available for DBCC statement 'undocumented statement'".
Also affects dbcc help ('?')
Link: http://www.sqlskills.com/blogs/paul/dbcc-writepage/
Scope: session only
Undocumented trace flag
Function: SQL 7 SP2 - Facilitates capturing a Sqlservr.exe user-mode crash dump for postmortem analysis
Link: None
Function: Disables parallel checking of objects by DBCC CHECKDB, DBCC CHECKFILEGROUP, and DBCC CHECKTABLE. By default, the degree of parallelism is automatically determined by the query processor.
The maximum degree of parallelism is configured just like that of parallel queries. For more information, see Configure the max degree of parallelism Server Configuration Option.
Note: Parallel DBCC checks should typically be enabled (default). The query processor reevaluates and automatically adjusts parallelism for each table or batch of tables checked by DBCC CHECKDB.
The typical use scenario is when a system administrator knows that server load will increase before DBCC CHECKDB completes, and so chooses to manually decrease or disable parallelism, in order to increase concurrency with other user workload. However, disabling parallel checks in DBCC CHECKDB can cause it to take longer to complete.
Note: If DBCC CHECKDB is executed using the TABLOCK option and parallelism is disabled, tables may be locked for longer periods of time.
Note: Starting with SQL Server 2014 (12.x) SP2, a MAXDOP option is available to override the max degree of parallelism configuration option of sp_configure for the DBCC statements.
Link: Docs Trace Flags
Link: http://www.sqlskills.com/blogs/paul/checkdb-from-every-angle-how-long-will-checkdb-take-to-run
Link: Important Trace Flags That Every DBA Should Know
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-2528/
Scope: global or session
Undocumented trace flag
Function: Displays memory usage for DBCC commands when used with TF 3604
Link: None
Undocumented trace flag
Function: Allows you to see inactive records in transaction log using fn_dblog.
Similar to trace flag 2537 for older version than SQL Server 2008.
Link: http://www.sqlsoldier.com/wp/sqlserver/day19of31daysofdisasterrecoveryhowmuchlogcanabackuplog
Undocumented trace flag
Function: By using this trace flag, function fn_dblog()
will read both active and inactive portions of transaction log.
Link: http://www.sqlsoldier.com/wp/sqlserver/day19of31daysofdisasterrecoveryhowmuchlogcanabackuplog
Link: http://www.sqlskills.com/blogs/paul/finding-out-who-dropped-a-table-using-the-transaction-log
Link: http://sqlserverandme.blogspot.ru/2014/03/how-to-view-transaction-log.html
Link: https://www.sqlservergeeks.com/trace-flag-2537/
Scope: session only
Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Link: Controlling SQL Server memory dumps
Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Undocumented trace flag
Function: Produces a full memory dump
Link: KB917825
Link: https://blogs.msdn.microsoft.com/askjay/2010/02/05/how-can-i-create-a-dump-of-sql-server
Link: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/13ce4292-b8a7-41fa-a173-645693957d70/sqldumper?forum=sqldisasterrecovery&forum=sqldisasterrecovery
Link: SQL Server Trace Flag 2544, Trace Flag 2546 and Trace Flag 2551
Scope: Session
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Function: Generates dump file for all threads of SQL Server (mini dump).
Link: KB917825
Link: https://blogs.msdn.microsoft.com/askjay/2010/02/05/how-can-i-create-a-dump-of-sql-server
Link: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/13ce4292-b8a7-41fa-a173-645693957d70/sqldumper?forum=sqldisasterrecovery&forum=sqldisasterrecovery
Link: https://blogs.msdn.microsoft.com/psssql/2008/09/12/sql-server-2000-2005-2008-recoveryrollback-taking-longer-than-expected
Link: SQL Server Trace Flag 2544, Trace Flag 2546 and Trace Flag 2551
Scope: Session
Function: Unknown, but related to controlling the contents of a
memory dump
Link: KB917825
Function: Shrink will run faster with this trace flag if there are LOB pages that need conversion and/or compaction, because that actions will be skipped.
Link: http://blogs.msdn.com/b/psssql/archive/2008/03/28/how-it-works-sql-server-2005-dbcc-shrink-may-take-longer-than-sql-server-2000.aspx
Thanks to: Andrzej Kukula
Function: Forces the DBCC CHECKDB
command to assume each database file is on a unique disk drive but treating different physical files as one logical file.
DBCC CHECKDB
command builds an internal list of pages to read per unique disk drive across all database files.
This logic determines unique disk drives based on the drive letter of the physical file name of each file.
Note: Do not use this trace flag unless you know that each file is based on a unique physical disk.
Note: Although this trace flag improve the performance of the DBCC CHECKDB commands which target usage of the PHYSICAL_ONLY option, some users may not see any improvement in performance.
While this trace flag improves disk I/O resources usage, the underlying performance of disk resources may limit the overall performance of the DBCC CHECKDB command.
Link: http://blogs.msdn.com/b/saponsqlserver/archive/2011/12/22/faster-dbcc-checkdb-released-in-sql-2008-r2-sp1-traceflag-2562-amp-2549.aspx
Link: https://support.microsoft.com/help/2634571
Link: https://support.microsoft.com/help/2732669
Link: Docs Trace Flags
Link: KB2964518
Scope: global only
Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Undocumented trace flag
Function: Produces a filtered memory dump
Link: KB917825
Link: https://connect.microsoft.com/SQLServer/feedback/details/477863/sql-server-is-terminating-because-of-fatal-exception-c0150014
Link: Let’s talk about trace flags
Link: SQL Server Trace Flag 2544, Trace Flag 2546 and Trace Flag 2551
Scope: Session
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Function: Unknown, but related to controlling the contents of a
memory dump
Link: KB917825
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Function: Disables integration between CHECKDB and Watson
Link: KB917825
Link: Controlling SQL Server memory dumps
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825
Function: Runs the DBCC CHECKDB command in a single "batch" regardless of the number of indexes in the database.
By default, the DBCC CHECKDB command tries to minimize TempDB resources by limiting the number of indexes or "facts" that it generates by using a "batches" concept.
But this trace flag forces all processing into one batch.
One effect of using this trace flag is that the space requirements for TempDB may increase. TempDB may grow to as much as 5% or more of the user database that is being processed by the DBCC CHECKDB command.
Note: Although this trace flag improve the performance of the DBCC CHECKDB commands which target usage of the PHYSICAL_ONLY option, some users may not see any improvement in performance. While this trace flag improves disk I/O resources usage, the underlying performance of disk resources may limit the overall performance of the DBCC CHECKDB command.
Link: http://blogs.msdn.com/b/saponsqlserver/archive/2011/12/22/faster-dbcc-checkdb-released-in-sql-2008-r2-sp1-traceflag-2562-amp-2549.aspx
Link: https://support.microsoft.com/help/2634571
Link: https://support.microsoft.com/help/2732669
Link: Docs Trace Flags
Link: KB2964518
Scope: global only
Function: Runs the DBCC CHECKDB
command without data purity check unless DATA_PURITY
option is specified.
Note: Column-value integrity checks are enabled by default and do not require the DATA_PURITY option.
For databases upgraded from earlier versions of SQL Server, column-value checks are not enabled by default until DBCC CHECKDB WITH DATA_PURITY
has been run error free on the database at least once.
After this, DBCC CHECKDB
checks column-value integrity by default.
Link: Docs Trace Flags
Link: https://sqlperformance.com/2012/11/io-subsystem/minimize-impact-of-checkdb
Link: https://support.microsoft.com/help/2888996/
Link: KB2964518
Scope: global only
Function: For SQL Server since 2005. Forces DBCC HELP to return syntax of undocumented DBCC statements.
If 2520/2588 is not turned on, DBCC HELP will refuse to give you the syntax stating: "No help available for DBCC statement 'undocumented statement'".
Also affects dbcc help ('?')
Link: http://www.sqlskills.com/blogs/paul/dbcc-writepage/
Scope: session only
Function: When used in conjunction with trace flag 3656, enables symbol resolution on stack dumps when the Debugging Tools for Windows are installed.
For more information, see this Microsoft Whitepaper.
WARNING: This is a debugging trace flag and not meant for production environment use.
Note: This trace flag applies to SQL Server 2019 (15.x) and higher builds.
Link: Docs Trace Flags
Scope: global or session
Function: SQL 6.5 - Sets the @@ERROR
system function to 50000 for RAISERROR
messages with severity levels of 10 or less. When disabled, sets the @@ERROR system function to 0 for RAISERROR messages with severity levels of 10 or less
Link: None
Undocumented trace flag
TF2861 only exists in SQL Server 2000 SP3 and SP4, was removed before 2005 shipped, and if you’re using it now you’re definitely incorrect and should removed it from your startup parameters/application code that enables it.
Function: Keep zero cost plans in cache. Tip: Avoid Using Trace Flag 2861 to Cache Zero-Cost Query Plan
Link: http://www.seangallardy.com/trace-flag-2861-the-trace-flag-the-myth-the-legend/
Function: Both 2880 and 2881 are related to a SQL 2000 hotfix introduced to solve problems where ad-hoc queries would cause the procedure cache to get too big
Link: None
Function: Both 2880 and 2881 are related to a SQL 2000 hotfix introduced to solve problems where ad-hoc queries would cause the procedure cache to get too big
Link: None
Function: Stops sending backup entries into MSDB
Link: https://bytes.com/topic/sql-server/answers/162385-how-do-i-prevent-sql-2000-posting-message-event-viewer-application-log
Function: Returns more info about Instant File Initialization. Shows information about backups and file creations use with 3605 to direct to error log.
Can be used to ensure that SQL Server has been configured to take advantage of IFI correctly.
Link: https://blogs.msdn.microsoft.com/psssql/2008/01/23/how-it-works-what-is-restorebackup-doing/
Link: Important Trace Flags That Every DBA Should Know
Link: https://blogs.msdn.microsoft.com/sql_pfe_blog/2009/12/22/how-and-why-to-enable-instant-file-initialization/
Link: Undocumented Trace Flags: Inside the Restore Process
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3004/
Scope: session only
Function: Returns more info about backups to the errorlog: Backup activity, Restore activity, File creation.
Link: Important Trace Flags That Every DBA Should Know
Link: https://blogs.msdn.microsoft.com/psssql/2008/02/06/how-it-works-how-does-sql-server-backup-and-restore-select-transfer-sizes
Link: Undocumented Trace Flags: Inside the Restore Process
Link: What’s CHECKDB doing in my database restore?
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3014/
Scope: session only
Function: Enables CHECKSUM
option as default for BACKUP
command.
Note: Beginning with SQL Server 2014 this behavior is controlled by setting the backup checksum default configuration option.
For more information, see Server Configuration Options (SQL Server).
Link: https://support.microsoft.com/help/2656988
Link: Docs Trace Flags
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3023/
Scope: global or session
Function: Enables a hotfix for a problem encountered when backing up to tape with specific backup options
Link: None
Function: SQL 9 - Will turn the NO_LOG and TRUNCATE_ONLY options into checkpoints in all recovery modes
Link: http://www.sqlskills.com/blogs/paul/backup-log-with-no_log-use-abuse-and-undocumented-trace-flags-to-stop-it
Function: Overrides the server default, and thus always forces backup compression unless the backup command had the no_compression clause explicitly present.
Link: https://blogs.msdn.microsoft.com/ialonso/2012/02/24/vdi-backups-and-backup-compression-default
Function: Overrides the server default to always avoid compression, unless the backup command explicitly uses the compression clause. If both 3034 and 3035 are enabled, 3035 takes precedence
Link: https://blogs.msdn.microsoft.com/ialonso/2012/02/24/vdi-backups-and-backup-compression-default
Function: As long as the SQL edition supports backup compression, this will allow VDI backups to be affected by the default compression setting just as non-VDI BACKUP commands are affected.
Link: https://blogs.msdn.microsoft.com/ialonso/2012/02/24/vdi-backups-and-backup-compression-default
Function: Bypasses the default backup compression pre-allocation algorithm to allow the backup file to grow only as needed to reach its final size. This trace flag is useful if you need to save on space by allocating only the actual size required for the compressed backup. Using this trace flag might cause a slight performance penalty (a possible increase in the duration of the backup operation).
For more information about the pre-allocation algorithm, see Backup Compression (SQL Server).
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/2001026/inf-space-requirements-for-backup-devices-in-sql-server
Link: https://blogs.msdn.microsoft.com/psssql/2011/08/11/how-compressed-is-your-backup/
Link: https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/backup-compression-sql-server
Link: https://sqlstudies.com/2017/03/16/compressed-backup-errors-and-tf-3042/
Scope: global only
Function: Enables SQL Server Backup to URL logging to a specific error log file.
Link: Docs Trace Flags
Link: https://msdn.microsoft.com/en-us/library/jj919149.aspx
Scope: global only
Function: Enables functionality after a hotfix that allows a log backup that was taken on a t-logfile hosted on a drive with “Bytes per physical sector”=512 to be restored onto a log file/drive that has “Bytes per physical sector”=4096
Link: https://support.microsoft.com/help/2987585/restore-log-with-standby-mode-on-an-advanced-format-disk-may-cause-a-9004-error-in-sql-server-2008-r2-or-sql-server-2012
Function: Fix performance problems when restoring database with CDC
Link: https://support.microsoft.com/help/2567366/
Function: Causes SQL Server to bypass checking for free space
Link: http://sqlblogcasts.com/blogs/martinbell/archive/2011/07/06/Mount-point-Permission-Issues.aspx
Link: http://www.databasejournal.com/features/mssql/article.php/1547551/Troubleshooting-SQL-Server-BackupRestore-Problems.htm
Function: Required to move sys databases
Link: None
Function: “FIX: Backup or Restore Using Large Transaction Logs May Return Error 3241” Causes LogMgr::ValidateBackedupBlock to be skipped during backup and restore operations, allowing backups of very large T-logs to succeed.
Link: None
Function: QL 9 - SQL Server 2005 tries to restore the log files and the data files in a single step which some third-party snapshot backup utilities do not support. Turing on 3117 does things the SQL 8 way multiple-step restore process.
Link: None
Function: Disable HW compression for backup to tape drives
Link: Docs Trace Flags
Scope: global only
Function: Fixes SQL 6.5 so that tape drives work correctly with DUMP and LOAD statements
Link: None
Function: According to Bob Ward’s PASS 2014 talk on SQL Server IO, prints information about “collisions and wait times” that occur between the various “Asynchronous Disk Pool” threads during BACKUP (what about RESTORE?) operations.
Link: None
Function: Prints “Backup stats” to the SQL log
Link: https://blogs.msdn.microsoft.com/ialonso/2012/10/24/why-does-restoring-a-database-needs-tempdb
Function: Output buffer info for backups to ERRORLOG
Link: https://blogs.msdn.microsoft.com/psssql/2008/02/06/how-it-works-how-does-sql-server-backup-and-restore-select-transfer-sizes
Link: https://blogs.msdn.microsoft.com/psssql/2008/01/28/how-it-works-sql-server-backup-buffer-exchange-a-vdi-focus/
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-3213/
Scope: global or session
Function: Prints quite a lot of info about RESTORE internals. Only seems to print to the error log (TF 3605 is required).
Link: http://jamessql.blogspot.ru/2013/07/trace-flag-for-backup-and-restore.html
Function: Disables the read ahead that is used by the recovery operation during roll forward operations
Link: TECHNET List Of SQL Server Trace Flags
Function: By default, every successful backup operation adds an entry in the SQL Server error log and in the system event log.
If you create very frequent log backups, these success messages accumulate quickly, resulting in huge error logs in which finding other messages is problematic.
With this trace flag, you can suppress these log entries. This is useful if you are running frequent log backups and if none of your scripts depend on those entries.
Link: Docs Trace Flags
Link: http://www.sqlskills.com/blogs/paul/fed-up-with-backup-success-messages-bloating-your-error-logs
Link: https://blogs.msdn.microsoft.com/sqlserverstorageengine/2007/10/30/when-is-too-much-success-a-bad-thing
Link: Important Trace Flags That Every DBA Should Know
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3226/
Scope: global only
Function: SQL 8/9 - Will turn the NO_LOG and TRUNCATE_ONLY options into no-ops in FULL/BULK_LOGGED recovery mode, and will clear the log in SIMPLE recovery mode. When set, BACKUP LOG with TRUNCATE_ONLY and BACKUP LOG with NO_LOG do not allow a log backup to run if the database's recovery model is FULL or BULK_LOGGED.
Link: http://www.sqlskills.com/blogs/paul/backup-log-with-no_log-use-abuse-and-undocumented-trace-flags-to-stop-it
Link: http://www.sqlskills.com/blogs/kimberly/understanding-backups-and-log-related-trace-flags-in-sql-server-20002005-and-2008
Scope: ?
Undocumented trace flag
Function: SQL 6.5 - Used after backup restoration fails
Scope: ?
Function: Prints the recovery timings
Link: https://connect.microsoft.com/SQLServer/feedback/details/392158/recovery-portion-of-sql-2008-restore-takes-much-longer-than-normal-when-restoring-from-sql-2005-backup
Function: This forces SQL Server startup to use a single thread when recovering all DBs at SQL Server startup, instead of running through its algorithm for determining how many threads to allocate to DB recovery
Link: https://blogs.msdn.microsoft.com/ialonso/2012/10/08/how-much-is-crash-recovery-parallelized-in-which-order-are-databases-recovered/
Undocumented trace flag
Function: The KB article refers to SQL 6.5, but it is possible that the TF still prints out info to the SQL error log, so leaving it here for now. KB: “...reports when each transaction
is rolled forward or back [examine the error log for progress]. However, you will not see any progress if SQL Server is rolling a large transaction forward or back. Additionally, this trace flag duplicates
the sp_configure setting Recovery flags..."
Link: None
Function: Cause auditing of transaction log records as they're read (during transaction rollback or log recovery).
This is useful because there is no equivalent to page checksums for transaction log records and so no way to detect whether log records are being corrupted e careful with these trace flags - I don't recommend using them unless you are experiencing corruptions that you can't diagnose.
Turning them on will cause a big CPU hit because of the extra auditing that's happening.
Link: https://support.microsoft.com/help/215458
Link: http://www.sqlskills.com/blogs/paul/how-to-tell-if-the-io-subsystem-is-causing-corruptions
Link: http://technet.microsoft.com/en-au/library/cc917726.aspx
Link: Important Trace Flags That Every DBA Should Know
Scope: ?
Function: Enables fix for issue when many consecutive transactions inserting data into temp table in SQL Server 2016 consume more CPU than in SQL Server 2014.
Another change in SQL Server 2016 behavior that could impact tempdb-heavy workloads has to do with Common Criteria Compliance (CCC), also known as C2 auditing.
We introduced functionality to allow for transaction-level auditing in CCC which can cause some additional overhead, particularly in workloads that do heavy inserts and updates in temp tables
Unfortunately, this overhead is incurred whether you have CCC enabled or not. In SQL Server 2016 you can enable trace flag 3427 to bypass this overhead starting with SP1 CU2. Starting in SQL Server 2017 CU4, we automatically bypass this code if CCC is disabled.
Note: This trace flag applies to SQL Server 2016 (13.x) SP1 CU2 through SQL Server 2016 (13.x) SP2 CU2. Starting with SQL Server 2016 (13.x) SP2 CU3 and SQL Server 2017 (14.x), this trace flag has no effect.
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/3216543
Link: TEMPDB – Files and Trace Flags and Updates
Scope: global only
Function: Introduced in the KB to fix a race condition leading to a hung database in mirroring failover situations. “ This trace flag forces new connections to keep checking for
database state every two seconds instead of waiting for a lock for infinite time. It helps ending the connection tasks faster as the mirroring reac
hes the start of the recovery phase and releasing more worker threads to be used by database mirroring.”
Link: https://support.microsoft.com/help/2970421/
Function: If you enable global TF 3449 (and you are on SQL Server 2012 SP3 CU3 or later or SQL Server 2014 SP1 CU7 or later),
you will get much better performance by avoiding a FlushCache call in a number of different common scenarios, such as backup database,
backup transaction log, create database, add a file to a database, restore a transaction log, recover a database, shrink a database file, and a SQL Server “graceful” shutdown.
Link: https://support.microsoft.com/help/3158396/
Link: https://blogs.msdn.microsoft.com/psssql/2017/06/29/sql-server-large-ram-and-db-checkpointing/
Link: Hidden Performance & Manageability Improvements in SQL Server 2012 / 2014
Link: KB2964518
Scope: global only
Function: Disables parallel redo.
Assume that you use an Always On availability group (AG) that contains heap tables.
Starting in SQL Server 2016, parallel thread for redo operations is used in secondary replicas.
In this case, heap tables redo operation may generate a runtime assert dump or the SQL Server may crash with an access violation error in some cases.
Note: This trace flag applies to SQL Server 2016 (13.x), SQL Server 2017 (14.x), and higher builds.
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/3200975/
Link: https://support.microsoft.com/help/4101554/
Link: https://support.microsoft.com/help/4339858/
Scope: global only
Function: Disables indirect checkpoints on tempdb
.
Note: This trace flag applies to SQL Server 2016 (13.x) SP1 CU5, SQL Server 2017 (14.x) CU1 and higher builds.
Link: Docs Trace Flags
Link: https://techcommunity.microsoft.com/t5/SQL-Server/Indirect-Checkpoint-and-tempdb-8211-the-good-the-bad-and-the-non/bc-p/851152#M1351
Scope: global only
Undocumented trace flag
Function: Provides a workaround for doing a rolling upgrade from SQL 2005 to SQL 2008 with a DB that has a full-text index
Link: None
Function: Write checkpoint start and end messages in the SQL Server error log.
Link: Important Trace Flags That Every DBA Should Know
Link: https://blogs.msdn.microsoft.com/joaol/2008/11/20/sql-server-checkpoint-problems/
Link: http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1530-checkpoint-only-writes-pages-from-committed-transactions/
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3502/
Scope: session only
Function: Indicates whether the checkpoint at the end of automatic recovery was skipped for a database (this applies only to read-only databases)
Link: http://www.sql-server-performance.com/2002/traceflags/
Undocumented trace flag
Function: For internal testing. Will raise a bogus log-out-of-space condition from checkpoint
Link: https://blogs.msdn.microsoft.com/joaol/2008/11/20/sql-server-checkpoint-problems/
Link: http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-1530-checkpoint-only-writes-pages-from-committed-transactions/
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3504/
Link: https://www.sqlshack.com/sql-server-checkpoint-lazy-writer-eager-writer-and-dirty-pages-in-sql-server/
Scope: Session only
Undocumented trace flag
Function: Disables automatic checkpoints.
Setting trace flag 3505 may increase recovery time and can prevent log space reuse until the next checkpoint is issued.
Make sure to issue manual checkpoints on all read/write databases at appropriate time intervals.
"For high availability systems, such as clusters, Microsoft recommends that you do not change the recovery interval because it may affect data safety and availability."
Link: http://www.sqlskills.com/blogs/paul/benchmarking-1-tb-table-population-part-2-optimizing-log-block-io-size-and-how-log-io-works/
Link: Important Trace Flags That Every DBA Should Know
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3505/
Scope: global only
Function: Appears to disable CPU instruction prefetching. The Blog post to the right uses it, in concert with 3603, to enable SQL 2000 to run on a machine with a # of processors that is not a power of 2
Link: https://blogs.msdn.microsoft.com/sqlserverfaq/2009/05/27/info-sql-2000-msde-installation-will-fail-if-you-have-number-of-cpus-on-a-box-which-is-not-in-power-of-2
Function: Records all error and warning messages sent to the client
Link: https://support.microsoft.com/help/199037/
Function: Disables “Simultaneous Multithreading Processor check”. Used in concern with TF 3601 in the blog post to the right to enable SQL 2000 to run on a machine with a # of processors that is not a power of 2
Link: https://blogs.msdn.microsoft.com/sqlserverfaq/2009/05/27/info-sql-2000-msde-installation-will-fail-if-you-have-number-of-cpus-on-a-box-which-is-not-in-power-of-2
Undocumented trace flag
Function: Enables the output from a large number of trace flags and DBCC commands to be sent back to the client.
The Connect issue notes that problems can occur when using 3604 with a query that executes across a linked server.
This CSS page points out that 3604 is necessary for DBCC DumpTrigger(‘display’)
Link: http://blogs.msdn.com/b/askjay/archive/2011/01/21/why-do-we-need-trace-flag-3604-for-dbcc-statements.aspx
Link: Internals of the Seven SQL Server Sorts – Part 1
Link: https://connect.microsoft.com/SQLServer/feedback/details/306380/trace-flag-issue-7300-3604
Link: How to Find the Statistics Used to Compile an Execution Plan
Link: A Row Goal Riddle
Link: Undocumented Trace Flags: Inside the Restore Process
Link: What’s CHECKDB doing in my database restore?
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3604/
Link: Cardinality Estimation for Multiple Predicates
Scope: session only
Function: Sends a variety of types of information to the SQL Server error log instead of to the user console.
Often referenced in KB and blog articles in the context of other trace flags (e.g. 3604).
Link: https://blogs.msdn.microsoft.com/askjay/2011/01/21/why-do-we-need-trace-flag-3604-for-dbcc-statements/
Link: Undocumented Trace Flags: Inside the Restore Process
Link: What’s CHECKDB doing in my database restore?
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3605/
Scope: session only
Function: Skip recovery on startup
Link: http://sqlkbs.blogspot.se/2008/01/trace-flag.html
Link: https://blogs.msdn.microsoft.com/ialonso/2012/10/24/why-does-restoring-a-database-needs-tempdb/
Function: Prevents SQL Server from automatically starting and recovering any database except the master database.
If activities that require TempDB are initiated, then model is recovered and TempDB is created. Other databases will be started and recovered when accessed.
Some features, such as snapshot isolation and read committed snapshot, might not work. Use for Move System Databases and Move User Databases.
Note: Do not use during normal operation.
Link: Docs Trace Flags
Link: Importance of Performing DBCC CHECKDB on all SQL Server Databases
Link: https://blogs.msdn.microsoft.com/ialonso/2012/10/24/why-does-restoring-a-database-needs-tempdb
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-3608/
Scope: global only
Function: Recovering all databases, but not clearing tempdb
Link: http://basitaalishan.com/2012/02/20/essential-trace-flags-for-recovery-debugging/
Link: Importance of Performing DBCC CHECKDB on all SQL Server Databases
Link: https://blogs.msdn.microsoft.com/ialonso/2012/10/24/why-does-restoring-a-database-needs-tempdb
Scope: global only
Function: SQL 9 - Divide by zero to result in NULL instead of error
Link: None
Function: Modifies the order of startup operations so that SQL Server can successfully start up even if many user connections are being attempted during SQL startup
Link: None
Function: Limits the amount of information returned to users who are not members of the sysadmin fixed server role, by masking the parameters of some error messages using '**'.
This can help prevent disclosure of sensitive information.
Link: Docs Trace Flags
Scope: global only
Function: Turns on tracking of the CPU data for the sysprocesses table.
Link: None
Function: CSS’s mysterious description: “Includes ‘other errors’ in the dump based on a severity.”
Link: Controlling SQL Server memory dumps
Function: CSS: A memory dump will “include messages marked to include with this trace flag enabled.”
Link: Controlling SQL Server memory dumps
Function: Print diagnostic information. Trace Flag 3635 Diagnostics are written to the console that started it.
There are not written to the errorlog, even if 3605 is turned on.
Link: None
Function: Eliminates sending DONE_IN_PROC messages to client for each statement in stored procedure. This is similar to the session setting of SET NOCOUNT ON, but when set as a trace flag, every client session is handled this way.
Link: https://blogs.msdn.microsoft.com/selvar/2010/07/13/delete-operation-from-a-reporting-service-2005-report-manager-fails-with-internalcatalogexception-and-throws-watson-mini-dump
Undocumented trace flag
Function: Can cause stack dumps. For one query, this resulted in a parallel plan significantly more expensive than the naturally occurring serial plan.
Link: New Undocumented Trace Flags
Scope: ?
Function: Apparently increases info found in the sys.dm_os_memory_allocations DMV (which appears to have replaced the DBCC MEMOBJLIST command) Bob Ward also discusses it in his PASS 2013 session, saying that it turns on tracing for all memory allocations done by “Memory Objects” (a specific SQLOS memory term). This flag will have a significant impact on system performance.
Link: https://blogs.msdn.microsoft.com/psssql/2012/11/12/how-can-reference-counting-be-a-leading-memory-scribbler-cause
Link: https://blogs.msdn.microsoft.com/slavao/2005/08/30/talking-points-around-memory-manager-in-sql-server-2005
Link: https://support.microsoft.com/help/2888658/
Function: Enables symbol resolution on stack dumps when the Debugging Tools for Windows are installed.
For more information, see this Microsoft Whitepaper.
WARNING: This is a debugging trace flag and not meant for production environment use.
Link: Docs Trace Flags
Link: http://sqlcat.com/sqlcat/b/msdnmirror/archive/2010/05/11/resolving-dtc-related-waits-and-tuning-scalability-of-dtc.aspx
Link: Controlling SQL Server memory dumps
Link: http://www.sqlskills.com/blogs/paul/determine-causes-particular-wait-type
Scope: global or session
Function: Enables logging all errors to error log during server startup
Link: http://spaghettidba.com/2011/05/20/trace-flag-3659/
Link: Change SQL Server Collation – Back to Basics
Scope: global only
Function: W/o this flag, for DBs that have Auto_Close=true and for DBs on Express Edition, DB recovery is normally deferred until first user access when SQL starts up. This TF forces
DB recovery to always run (well, only for DBs that actually need recovery done) at SQL Server startup.
Link: https://blogs.msdn.microsoft.com/ialonso/2012/10/08/how-much-is-crash-recovery-parallelized-in-which-order-are-databases-recovered
Function: CSS: “By default [SQL Server] allows system cache involvement [with writing to the SQL Error log] to avoid some of the performance issues you might be suspecting, but you can force it to use FILE_FLAG_WRITE_THROUGH” with TF 3663
Link: http://blogs.msdn.com/b/psssql/archive/2011/01/07/discussion-about-sql-server-i-o.aspx
Function: Removes messages to error log about traces started and stopped
Link: https://support.microsoft.com/help/922578
Function: Logs extended errors to errorlog when network disconnect occurs, turned off by default. Will dump out the socket error code this can sometimes give you a clue as to the root cause.
Link: https://support.microsoft.com/help/922578
Function: Unknown
Link: Upgrading an expired SQL Server 2016 Evaluation Edition
Function: Prohibits use of USE DB statement
Link: None
Function: This flag allows the SQL Server DB startup code to move system tables to the primary filegroup.
Introduced due to behavior in the SQL 2014 upgrade process, where system tables could be created in a secondary filegroup (if that FG was the default).
Link: https://support.microsoft.com/help/3003760/
Undocumented trace flag
Function: In SQL Server 2019, when you enable the Memory-Optimized TempDB Metadata feature, this trace flag is automatically enabled after the next restart.
When you disable that feature, the trace flag is automatically removed after the next restart.
Also if you add race flag 3895 to startup parameters after restarting SQL Server option IsTempdbMetadataMemoryOptimized
will be enabled.
Link: https://github.com/ktaranov/sqlserver-kit/blob/master/Scripts/Trace_Flag/Trace_Flag_3895.sql
Scope: global only
Function: SQL 7/8 - SQL Server does not update the rowcnt column of the sysindexes system table until the transaction is committed. When turned on the optimizer gets row count information from in-memory metadata that is saved to sysindexes system table when the transaction commits.
Link: None
Function: According to Bob Ward’s PASS 2014 SQL Server IO talk, enables trace output (3605 is required) for the Eager Write functionality that is used with bulk logged operations (such as SELECT INTO)
Link: None
Function: Let SQL Server throw an exception to the application when the 3303 warning message is raised
Link: https://support.microsoft.com/help/3014867
Function: Enables automatic removal of orphaned DTC transactions with SPID=-2
, which is a problem for some 3rd party transaction monitors.
Link: https://support.microsoft.com/help/4519668
Link: https://support.microsoft.com/help/4511816
Scope: global only
Function: According to Bob Ward’s PASS 2014 SQL Server IO talk, forces the Eager Write functionality to throttle at 1024 outstanding eager writes.
Link: None
Undocumented trace flag
Function: Request Fua Writes.
SQL Server opens database data and log files with FILE_FLAG_WRITE_THROUGH, mapping to O_DSYNC in the Host Extension, asking for Fua writes.
Linux Default: Trace flag considered Off
Windows Default: Trace flag considered On
The trace flag does not apply to SQL Server on Linux SQL 2017 RTM thru CU5. The behavior is assumed enabled prior to CU 6.
The trace flag does not apply to Windows. On Windows it is always assumed to be enabled.**
On Linux, you need a file system that provides DpuFua=1
enabled or you have confirmed your system is O_DIRECT safe.
By enabling the trace flag you disable the batch flush requests from SQL Server and are trusting SQLPAL, HE and the I/O subsystem configuration to achieve durability.
Link: SQL Server On Linux: Forced Unit Access (Fua) Internals
Scope: global
Undocumented trace flag
Function: Avoid Fua Writes.
Forces SQL Server to open database data and log files without FILE_FLAG_WRITE_THROUGH
and issue the FlushFileBuffers
calls to complete transactions and checkpoint activities.
Linux Default: Trace flag is considered On
Windows Default: Trace flag is considered Off
Microsoft retains the policy that SQL Server should always be run on a system with stable media configurations.
The trace flag is NOT supported on Windows.
This article highlights these support boundaries.
It was written by David Campbell, Bob Ward, Keith Elmore and I many years ago and the forced flush feature does not alter the intent: “SQL Server requires systems to support ‘ guaranteed delivery to stable media ’ as outlined under the Microsoft SQL Server Always-On Storage Solution Review program.
For more information about the input and output requirements for the SQL Server database engine.
When running on Linux kernels or file systems that do not support optimized Fua capabilities.
The trace flag and forced flush behavior is intended to be a workaround for Linux installations until the SQL Server instance id deployed on a system providing optimized, Fua capabilities.
Link: SQL Server On Linux: Forced Unit Access (Fua) Internals
Scope: global
Function: Very verbose logging of each login attempt to the error log. Includes tons of information
Link: None
Function: Allows only shared memory connections to the SQL Server. Meaning, you will only be able to connect from the server machine itself.
Client connections over TCP/IP or named pipes will not happen.
Link: https://blogs.msdn.microsoft.com/sqlserverfaq/2011/05/11/inf-hey-my-sql-server-service-is-not-starting-what-do-i-do
Link: https://blogs.msdn.microsoft.com/psssql/2008/09/05/sql-server-2005-setup-fails-in-wow-x86-on-computer-with-more-than-32-cpus
Link: Upgrading an expired SQL Server 2016 Evaluation Edition
Function: Trace flag 4013 write entries in error log whenever a new connection established.
These entries contain login name and SPID also.
Link: http://sqlkbs.blogspot.se/2008/01/trace-flag.html
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-4013/
Scope: global or session
Function: Boot without recover
Link: None
Function: Directs the SQL instance to ignore stored procedures that have been configured as “auto-start” procedures. Their auto-start configuration is not affected, so the next time the instance is started w/o this flag they will return to their normal behavior.
Link: https://blogs.msdn.microsoft.com/sqlserverfaq/2011/05/11/inf-hey-my-sql-server-service-is-not-starting-what-do-i-do/
Link: Upgrading an expired SQL Server 2016 Evaluation Edition
Link: Change SQL Server Collation – Back to Basics
Scope: global only
Function: Logs extended errors to errorlog when network disconnect occurs, turned off by default.
Will dump out the socket error code this can sometimes give you a clue as to the root cause.
Link: https://blogs.msdn.microsoft.com/sql_protocols/2005/12/19/vss-sql-server-does-not-exist-or-access-denied
Function: Prints both a byte and ASCII representation of the receive buffer.
Used when you want to see what queries a client is sending to SQL Server.
You can use this trace flag if you experience a protection violation and want to determine which statement caused it.
Typically, you can set this flag globally or use SQL Server Enterprise Manager.
You can also use DBCC INPUTBUFFER.
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-4030/
Scope: global only
Function: Prints both a byte and ASCII representation of the send buffers (what SQL Server sends back to the client).
You can also use DBCC OUTPUTBUFFER.
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-4031/
Scope: global only
Function: Traces the SQL commands coming in from the client. When enabled with 3605 it will direct those all to the error log.
Link: https://support.microsoft.com/help/199037/
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-4032/
Scope: global only
Function: SA account can be unlocked by rebooting server with trace flag. If sa (or sso_role) password is lost, add this to your RUN_serverfile. This will generate new password when server started.
Link: None
Function: SQL 9+ Prints TDS packets sent to the client (output) to console. Startup only.
Link: None
Function: SQL 9+ Prints TDS packets received from the client to console. Startup only.
Link: None
Function: “FIX: Reorder outer joins with filter criteria before non-selective joins and outer joins” Enabling this flag may increase the chance that selective filter criteria on an OUTER
JOIN will influence the OJ earlier in the plan, rather than the more typical behavior of INNER JOINs being prioritized before OJs. Note that 4101 is also required to enable KB942444.
Link: https://support.microsoft.com/help/318530/
Function: SQL 9 - Query performance is slow if the execution plan of the query contains semi join operators Typically, semi join operators are generated when the query contains the IN keyword or the EXISTS keyword. Enable flag 4102 and 4118 to overcome this.
Link: https://support.microsoft.com/help/946020/
Function: “FIX: A query may take longer to run in SQL Server 2005 SP1 than it takes to run in the original release version of SQL Server 2005 or in SQL
Server 2000” Applies particularly to queries that contain subqueries with “many column joins”.
Link: None
Function: SQL 9 - Overestimating cardinality of JOIN operator. When additional join predicates are involved, this problem may increase the estimated cost of the JOIN operator to the point where the query optimizer chooses a different join order. When the query optimizer chooses a different join order, SQL 9 system performance may be slow.
Link: None
Function: “FIX: The SQL Server 2005 query optimizer may incorrectly estimate the cardinality for a query that has a predicate that contains an index union alternative”
Link: None
Function: “FIX: A query may take a long time to compile when the query contains several JOIN clauses against a SQL Server 2005 database”
Link: None
Function: SQL 9 - When you run a query that references a partitioned table, query performance may decrease
Link: None
Function: “FIX: The query performance is very slow when you use a fast forward-only cursor to run a query in SQL Server 2005”
Link: None
Function: “FIX: Error message when you run a query that uses a fast forward-only cursor in SQL Server 2005: "Query processor could not produce a query plan because of the hints defined in this query”
Link: https://support.microsoft.com/help/926773/
Function: “FIX: The query performance is slow when you run a query that uses a user-defined scalar function against an instance of SQL Server 2005”
Link: None
Function: Fixes a cardinality estimate issue with an unnamed builtin function. The KB article title shows that the issue was initially hit due to timeouts with the Replication Merge agent, but the problem was ultimately a poor query plan.
Link: None
Function: Enables a fix for a problem that occurs when a linked server from 2005 or 2008 targets SQL 2000: “This problem occurs because SQL Server 2005 generates an
execution plan that has a remote query. SQL Server 2005 must execute the remote query against SQL Server 2000 to retrieve the required data. SQL Server 2000 cannot
handle the remote query. Therefore, error 107 occurs in SQL Server 2000. Then, error 107 is propagated back to SQL Server 2005. Therefore, error 107 occurs in SQL Server
2005, and error 8180 occurs in SQL Server 2005.”
Link: https://support.microsoft.com/help/936223/
Function: “FIX: A query that you run by using a FORWARD_ONLY cursor takes alonger time to run in Microsoft SQL Server 2005 than in SQL Server 2000 ”The fix apparently increases the likelihood that a certain type of cursor will use an index seek (as it did in SQL 2000) rather than regressing to a scan for each Fetch. The notes also contain some interesting info about sp_cursoropen
Link: None
Function: SQL 9 - Query runs slowly when using joins between a local and a remote table
Link: None
Function: “FIX: A blocking issue occurs when you update rows in a table in SQL Server 2005...[A] problem occurs because the positioned update in a transaction performs a table scan on all involved tables. This behavior causes many update locks to be generated on many rows in the table. Additionally, SQL Server tries to add an update lock on the ow that has already been granted an exclusive lock by another transaction. Therefore, a blocking issue occurs.”
Link: None
Function: “FIX: The query performance is slower when you run the query in SQL Server 2005 than when you run the query in SQL Server 2000” The example given in the KB article indicates that selective LIKE predicates may not be considered fully when less-selective “comparison” (e.g. =, >, etc) predicates are done on the same parameter (or variable?) value as the LIKE predicate.
Link: None
Function: “FIX: Error message when you perform an update operation by using a cursor in SQL Server 2005: Transaction (Process ID
Link: https://support.microsoft.com/help/953948/
Function: SQL 9 - Query that involves an outer join operation runs very slowly. However, if you use the FORCE ORDER query hint in the query, the query runs much faster. Additionally, the execution plan of the query contains the following text in the Warnings column: NO JOIN PREDICATE.
Link: None
Function: Query that has many outer joins takes a long time to compile in SQL Server 2005
Link: None
Function: “FIX: A query performance issue occurs when you run a query against a column of the bigint data type in SQL Server 2005... If the All Density column [of SHOW_STATISTICS] displays incorrect values of 1, you are encountering this problem”
Link: None
Function: SQL 9 - Query may take more time to finish if using an inner join to join a derived table that uses DISTINCT keyword
Link: None
Function: “FIX: The synchronization process is slow, and the CPU usage is high on the computer that is configured as the Distributor in SQL Server 2005” The problem manifested as a replication performance issue, but the following phrase found in the KB article indicates that it is a query processor issue: “the query that performs poorly shows that a join predicate is not pushed down to a Clustered Index Seek operator.”
Link: https://support.microsoft.com/help/959013/
Function: SQL 9 - Compilation time of some queries is very long in an x64-based version.
Basically its more than execution time because more memory allocations are necessary in the compilation process.
Link: Note
Function: “FIX: When you update rows by using a cursor in SQL Server 2005, the update may take a long time to finish”
Link: https://support.microsoft.com/help/957872/
Function: “FIX: The values of the datetime column are not same for the rows that are copied when you copy data to a table by using the GETDATE() function in Microsoft SQL Server 2005”
Link: None
Function: XML performance fix
Link: None
Function: “FIX: When you run a query that contains a JOIN operation in SQL Server 2005 or SQL Server 2008, and the ON clause of the JOIN operator contains a LIKE predicate, the query runs slower than in SQL Server 2000”
Link: None
Function: “FIX: The size of the SQL Server 2005 error log file or of the SQL Server 2008 error log file grows very quickly when query notifications are created and destroyed in a high ratio” & “FIX: The restore operation takes a long time when you restore a database that has query notification enabled in SQL Server 2005 or in SQL Server 2008”
Link: https://support.microsoft.com/help/958006/
Function: Bugfix for error: parallel query returning different results every time
The trace flag disables an optimization in the query optimizer.
The optimization caused the issue described in the KB article when you try to insert into a table by selecting from the table itself.
As turning on the trace flag could result in a perf degradation, you only should use it if you run into the issue described in the KB article.
Link: https://support.microsoft.com/help/2546901
Link: http://sql-sasquatch.blogspot.se/2014/04/whaddayaknow-bout-sqlserver-trace-flag.html
Link: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9ea718c2-e0e0-40cf-b12b-3269130448b7/trace-flag-4135-sql-server-2008?forum=sqldatabaseengine
Function: Bugfix for error inserting to temp table
Link: https://support.microsoft.com/help/960770
Link: https://connect.microsoft.com/SQLServer/feedback/details/541352/tempdb-errors-during-statistics-auto-update
Function: Disables parameter sniffing unless OPTION(RECOMPILE), WITH RECOMPILE or OPTIMIZE FOR value is used.
Starting with SQL Server 2016 (13.x), to accomplish this at the database level, see the PARAMETER_SNIFFING option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).
To accomplish the same result at the query level, add the OPTIMIZE FOR UNKNOWN query hint.
The OPTIMIZE FOR UNKNOWN
hint doesn't disable the parameter sniffing mechanism, but effectively bypasses it to achieve the same intended result.
Starting with SQL Server 2016 (13.x) SP1, a second option to accomplish this at the query level is to add the USE HINT 'DISABLE_PARAMETER_SNIFFING' query hint instead of using this trace flag.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: http://blogs.msdn.com/b/axinthefield/archive/2010/11/04/sql-server-trace-flags-for-dynamics-ax.aspx
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: http://kejser.org/trace-flag-4136-2/
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-4136/
Link: http://www.sqlservergeeks.com/sql-server-did-you-know-about-trace-flag-4136/
Link: KB2801413
Scope: global or session or query
Function: Causes SQL Server to generate a plan using minimum selectivity when estimating AND predicates for filters to account for partial correlation instead of independence, under the query optimizer cardinality estimation model of SQL Server 2012 (11.x) and earlier versions (70).
Starting with SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES' query hint instead of using this trace flag when using the CE 70.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Note: This trace flag does not apply to CE version 120 or above. Use trace flag 9471 instead.
Link: https://support.microsoft.com/help/2658214
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: KB2801413
Link: Cardinality Estimation for Multiple Predicates
Scope: global or session or query
Function: Causes SQL Server to generate a plan that does not use row goal adjustments with queries that contain TOP
, OPTION (FAST N)
, IN
, or EXISTS
keywords
Beginning with SQL Server 2016 SP1, to accomplish this at the query level, add the USE HINT
query hint instead of using this trace flag.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: https://support.microsoft.com/help/2667211
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: https://answers.sqlperformance.com/questions/1609/trying-to-figure-out-how-to-resolve-the-data-skew.html
Link: http://dba.stackexchange.com/questions/55198/huge-slowdown-to-sql-server-query-on-adding-wildcard-or-top
Link: KB2801413
Scope: global or session or query
Function: Enable automatically generated quick statistics (histogram amendment) regardless of key column status.
If trace flag 4139 is set, regardless of the leading statistics column status (ascending, descending, or stationary), the histogram used to estimate cardinality will be adjusted at query compile time
Beginning with SQL Server 2016 SP1, to accomplish this at the query level, add the USE HINT query hint instead of using this trace flag.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: https://support.microsoft.com/help/2952101
Link: Docs Trace Flags
Link: SQL Server - estimates outside of the histogram - half-baked draft
Link: Parallelism in Hekaton (In-Memory OLTP)
Link: Important Trace Flags That Every DBA Should Know
Link: https://support.microsoft.com/help/974006
Scope: global or session or query
Important: Query Optimizer fixes that address wrong results or access violation errors are not enabled by trace flag 4199.
Those fixes are not considered optional and become enabled by default once the update package is installed.
Function: Enables query optimizer (QO) changes released in SQL Server Cumulative Updates and Service Packs.
QO changes that are made to previous releases of SQL Server are enabled by default under the latest database compatibility level in a given product release, without trace flag 4199 enabled.
The following table summarizes the behavior when using specific database compatibility levels and trace flag 4199:
Database Engine (DE) version | Database compatibility level | TF 4199 | QO changes from all previous Database Compatibility Levels | QO changes for DE version post-RTM |
---|---|---|---|---|
13 (SQL Server 2016 (13.x)) | 100 to 120 | Off On |
Disabled Enabled |
Disabled Enabled |
130 (Default) | Off On |
Enabled Enabled |
Disabled Enabled |
|
14 (SQL Server 2017 (14.x)) | 100 to 120 | Off On |
Disabled Enabled |
Disabled Enabled |
130 | Off On |
Enabled Enabled |
Disabled Enabled |
|
140 (Default) | Off On |
Enabled Enabled |
Disabled Enabled |
|
15 (SQL Server 2019 (15.x)) and 12 (Azure SQL Database) |
100 to 120 | Off On |
Disabled Enabled |
Disabled Enabled |
130 to 140 | Off On |
Enabled Enabled |
Disabled Enabled |
|
150 (Default) | Off On |
Enabled Enabled |
Disabled Enabled |
Starting with SQL Server 2016 (13.x), to accomplish this at the database level, see the QUERY_OPTIMIZER_HOTFIXES option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).
Starting with SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT query hint instead of using this trace flag.
Link: https://support.microsoft.com/help/974006
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/974006/
Link: https://sqlworkbooks.com/2017/04/selectively-enabletrace-flag-4199-and-query_optimizer_hotfixes-in-sql-server-2016/
Link: https://sqlworkbooks.com/2017/04/trace-flag-4199-no-per-session-override-if-you-enable-it-globally/
Link: http://www.sqlservergeeks.com/sql-server-2016-database-scoped-configuration-and-trace-flag-4199/
Link: https://nebraskasql.blogspot.com/2018/11/things-i-learned-at-summit-v20-trace.html
Link: Let’s talk about trace flags
Link: KB2964518
Link: KB2801413
Scope: global or session or query
Function: Over comes SA password by startup. Disables password policy check during server startup.
Link: https://blogs.msdn.microsoft.com/sqlserverfaq/2011/05/11/inf-hey-my-sql-server-service-is-not-starting-what-do-i-do
Link: https://blogs.msdn.microsoft.com/sqlserverfaq/2008/07/31/upgrade-of-sql-server-2000-instance-to-sql-server-2005-fails-with-error-similar-to-enforce-password-policy
Function: Increases the size of the hash table that stores the cache entries by a factor of 8.
When used together with trace flag 4618 increases the number of entries in the TokenAndPermUserStore cache store to 8,192.
Link: https://support.microsoft.com/help/959823
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/psssql/2008/06/16/query-performance-issues-associated-with-a-large-sized-security-cache/
Scope: global only
Function: Disable the ring buffer logging - no new entries will be made into the ring buffer
Link: http://blogs.msdn.com/b/lcris/archive/2007/02/19/sql-server-2005-some-new-security-features-in-sp2.aspx
Function: Generate a minidump file whenever an entry is logged into the ring buffer
Link: http://blogs.msdn.com/b/lcris/archive/2007/02/19/sql-server-2005-some-new-security-features-in-sp2.aspx
Function: Enables SQL Server authenticated logins that use Windows domain password policy enforcement to log on to the instance even though the SQL Server service account is locked out or disabled on the Windows domain controller.
Link: https://support.microsoft.com/help/925744
Function: Makes server-level metadata visible to application roles.
In SQL Server, an application role cannot access metadata outside its own database because application roles are not associated with a server-level principal.
This is a change of behavior from earlier versions of SQL Server.
Setting this global flag disables the new restrictions, and allows for application roles to access server-level metadata.
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/906549/
Scope: global only
Function: Limits number of entries per user cache store to 1024.
It may incur a small CPU overhead as when removing old cache entries when new entries are inserted.
It performs this action to limit the size of the cache store growth. However, the CPU overhead is spread over time.
When used together with trace flag 4610 increases the number of entries in the TokenAndPermUserStore cache store to 8192
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/933564
Link: https://support.microsoft.com/help/959823/
Scope: global only
Function: According to the Connect item, causes permission checking to be done on a global cache instead of the per-user caches that were introduced in SQL 2008. The thread
includes some interesting information on the cache stores, especially as they relate to TokenPermAndUserStore.
Link: https://connect.microsoft.com/SQLServer/feedback/details/467661/sql-server-2008-has-incorrect-cache-names-in-sys-dm-os-memory-cache-counters
Function: SQL 9 – After 4610 & 4618 you can still customize the quota for TokenAndPermUserStore cache store that is based on the current workload
Link: https://support.microsoft.com/help/959823
Function: Pauses TDE encryption scan and causes encryption scan worker to exit without doing any work.
The database will continue to be in encrypting state (encryption in progress).
To resume re-encryption scan, disable trace flag 5004 and run ALTER DATABASE SET ENCRYPTION ON.
Link: Docs Trace Flags
Scope: global only
Function: Forces all I/O requests to go through engine 0.
This removes the contention between processors but could create a bottleneck if engine 0 becomes busy with non-I/O tasks.
Link: http://dba.fyicenter.com/Interview-Questions/SYBASE/What_is_Trace_Flag_Definitions_in_Sybase.html#1.3.4#1.3.4
Function: Prevents engine 0 from running any non-affinitied tasks.
Link: http://dba.fyicenter.com/Interview-Questions/SYBASE/What_is_Trace_Flag_Definitions_in_Sybase.html#1.3.4#1.3.4
Function: Alters default behavior of select…INTO (and other processes) that lock system tables for the duration of the transaction.
This trace flag disables such locking during an implicit transaction.
Link: https://support.microsoft.com/help/153096/
Function: Enables more than one large query compilation to gain access to the big gateway when there is sufficient memory available.
This trace flag can be used to keep memory usage for the compilation of incoming queries under control, avoiding compilation waits for concurrent large queries.
It is based on the 80 percentage of SQL Server Target Memory, and it allows for one large query compilation per 25 gigabytes (GB) of memory.
Note: Beginning with SQL Server 2014 SP2 and SQL Server 2016 this behavior is controlled by the engine and trace flag 6498 has no effect.
Link: https://support.microsoft.com/help/3024815
Link: Docs Trace Flags
Link: http://blogs.msdn.com/b/sql_server_team/archive/2015/10/09/query-compile-big-gateway-policy-changes-in-sql-server.aspx
Link: KB2964518
Scope: global only
Function: Disables generation of a memory dump on the first occurrence of an out-of-memory exception in CLR integration.
By default, SQL Server generates a small memory dump on the first occurrence of an out-of-memory exception in the CLR.
The behaviour of the trace flag is as follows: If this is used as a startup trace flag, a memory dump is never generated.
However, a memory dump may be generated if other trace flags are used.
If this trace flag is enabled on a running server, a memory dump will not be automatically generated from that point on.
However, if a memory dump has already been generated due to an out-of-memory exception in the CLR, this trace flag will have no effect.
Link: Docs Trace Flags
Scope: global only
Function: Enables a hotfix for “
FIX: Slow performance in SQL Server 2012 or SQL Server 2014 when you build an index on a spatial data type of a large table”
Link: https://blogs.msdn.microsoft.com/psssql/2013/11/19/spatial-indexing-from-4-days-to-4-hours
Link: https://support.microsoft.com/help/2896720/
Function: Enables adjustment in the SQLOS scheduling layer to handle queries that issue many short-duration calls to spatial data (which is implemented via CLR functions): “
This fix introduces the trace flag 6531 to indicate to the SQLOS hosting layer that the spatial data type should avoid preemptive protections. This can reduce the CPU consumption
and improve the overall performance for spatial activities. Only use this trace flag if the individual, spatial method invocations (per row and column) take less than ~4ms.
Longer invocations without preemptive protection could lead to scheduler concurrency issues and SQLCLR punishment messages logged to the error log.”
Link: https://support.microsoft.com/help/3005300/
Function: Enables performance improvement of query operations with spatial data types in SQL Server 2012 and SQL Server 2014.
The performance gain will vary, depending on the configuration, the types of queries, and the objects.
Link: KB3107399
Link: Docs Trace Flags
Link: KB2964518
Scope: global or session
Function: Enables performance improvement of query operations with spatial data types in SQL Server 2012 and SQL Server 2014.
The performance gain will vary, depending on the configuration, the types of queries, and the objects.
Link: KB3107399
Link: Docs Trace Flags
Link: KB2964518
Scope: global or session
Function: Enables performance improvement of query operations with spatial data types in SQL Server 2012, SQL Server 2014 and SQL Server 2016.
The performance gain will vary, depending on the configuration, the types of queries, and the objects.
Link: https://support.microsoft.com/help/3054180
Link: KB3107399
Link: https://blogs.msdn.microsoft.com/bobsql/2016/06/03/sql-2016-it-just-runs-faster-native-spatial-implementations/
Link: Docs Trace Flags
Link: KB2964518
Scope: global only
Function: Enables "CLR strict security" behavior (introduced in SQL Server 2017) in SQL Server 2012, SQL Server 2014, and SQL Server 2016.
When enabled, this option will require that all assemblies, regardless of PERMISSION_SET
, be signed, have an associated signature-based Login, and that the associated Login be granted the UNSAFE ASSEMBLY
permission.
Please note:
Undocumented trace flag
Function: Disable table lock promotion for text columns
Link: None
Function: Outputs extra info about linked server errors
Link: https://support.microsoft.com/help/314530
Link: https://support.microsoft.com/help/280106/
Link: https://support.microsoft.com/help/280102/
Link: https://connect.microsoft.com/SQLServer/feedback/details/306380/trace-flag-issue-7300-3604
Function: Fixes a problem in SQL 6.5 where SELECT INTO queries with text/image types were not bulk-logged.
Link: None
Function: Offers a new alternative to handling the tricky problem of converting Oracle NUMBER types (across OLEDB linked server queries) with unknown precision/scale to a valid SQL Server data type, by treating all such types as NUMERIC(38,10).
Link: https://support.microsoft.com/help/3051993/
Function: Forces NUMBER values with unknown precision/scale to be treated as double values with OLE DB provider
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/3051993
Scope: global or session
Function: Show the optimizer output and the post-optimization rewrite in action (After Post Optimization Rewrite)
Link: Internals of the Seven SQL Server Sorts – Part 1
Link: https://www.sql.kiwi/2013/08/sql-server-internals-nested-loops-prefetching.html
Link: http://www.queryprocessor.com/batch-sort-and-nested-loops
Link: Query Optimizer Deep Dive - Part 4
Link: Few Outer Rows Optimization
Related to 8607 trace flag
Scope: session only
Undocumented trace flag
Function: Added a probe residual to an adaptive join. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Function: Outputs info re: hashing operators, including role reversal, recursion levels, whether the Unique Hash optimization could be used, info about the hash-related bitmap, etc. Dima’s article is a must-read. For parallel query plans, 7357 does NOT send output to the console window. However, output to the SQL Server error log can be enabled by enabling 3605.
Link: http://www.queryprocessor.com/hash-join-execution-internals
Link: Query Optimizer Deep Dive - Part 4
Function: Disables the bitmap associated with hash matching. This bitmap is used for “bit-vector filtering” and can reduce the amount of data written to TempDB during hash spills.
Link: www.queryprocessor.com/hash-join-execution-internals
Undocumented trace flag
Function: Changed a nested loop join to have ordered prefetch.
Link: New Undocumented Trace Flags
Scope: ?
Function: Enables additional computations for memory grants required for sort operations.
Note: This trace flag applies to SQL Server 2012 (11.x) SP2 CU8, SQL Server 2014 (12.x) RTM CU10, SQL Server 2014 (12.x) SP1 CU3, and higher builds.
WARNING: Trace flag 7470 will increase memory requirements for queries using sort operators and may impact memory availability for other concurrent queries.
Link: https://support.microsoft.com/help/3088480/
Scope: global or session or query
Function: Enables the lightweight query execution statistics profiling infrastructure.
unless your server is already CPU bound, like you’re running all the time with 95% CPU, unless you are at that point, turn on this trace flag at any server you have.
This would be my advice here because this enables that lightweight profiling infrastructure there and then you’ll see in a few minutes what it unleashes here.
So one thing that happens when I enable the lightweight profiling is that the sys.dm_exec_query_profiles DMV, which is something that actually populates the live query stats ability or feature of SSMS, now also is also populated with this lightweight profiling, which means that for all essence, we are now able to run a live query stats on all fashions at any given point in time, and this is extremely useful for let’s say a production DBA that someone calls and says, “Hey, you have a problem. To tap into running system and look at what it’s doing.”
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/3170113
Link: https://www.brentozar.com/archive/2017/10/get-live-query-plans-sp_blitzwho/
Link: https://groupby.org/conference-session-abstracts/enhancements-that-will-make-your-sql-database-engine-roar-2016-sp1-edition/
Link: https://www.scarydba.com/2018/06/11/plan-metrics-without-the-plan-trace-flag-7412/
Link: KB2964518
Scope: global only
Function: Fix for sort operator spills to tempdb in SQL Server 2012 or SQL Server 2014 when estimated number of rows and row size are correct
Link: https://support.microsoft.com/help/3088480
Function: Running multiple UPDATE STATISTICS
for different statistics on a single table concurrently.
Trace Flag 7471 changes the locking behavior of update statistics command such that SQL Server engine no longer acquires X LOCK
on UPDSTATS resource on the table.
Rather the engine acquires an (update) U LOCK
on each individual statistics object being updated which doesn't block other parallel threads on the same table running on different statistics.
This behavior improves the overall concurrency of the update statistics job run executing in parallel and improves its performance.
TF 7471 can increase the possibility of deadlock especially when creation of new statistics and updating of existing statistics are executed simultaneously.
So the recommended best practice is to use TF 7471 only as a part of maintenance when update statistics jobs are run in parallel and should be turned off otherwise.
Link: https://support.microsoft.com/help/3156157
Link: http://sqlperformance.com/2016/05/sql-performance/parallel-rebuilds
Link: KB2964518
Link: https://blogs.msdn.microsoft.com/sql_server_team/boosting-update-statistics-performance-with-sql-2014-sp1cu6/
Scope: global only
Function: Behavior and intended purpose unknown, but in this post Paul White uses it in concert with 7498 to disable “optimized bitmaps”.
Link: https://sqlperformance.com/2015/11/sql-plan/hash-joins-on-nullable-columns
Function: Behavior and intended purpose unknown, but in this post Paul White uses it in concert with 7497 to disable “optimized bitmaps”.
Link: https://sqlperformance.com/2015/11/sql-plan/hash-joins-on-nullable-columns
Function: Dynamic cursors are used by default on forward-only cursors.
Dynamic cursors are faster than in earlier versions and no longer require unique indexes.
This flag disables the dynamic cursor enhancements and reverts to version 6.0 behavior.
Link: None
Function: Disable cursor plan caching for extended stored procedures
Link: http://basitaalishan.com/2012/02/20/essential-trace-flags-for-recovery-debugging/
Function: Enables version 6.x handling of return codes when calling dbcursorfetchex and the resulting cursor position follows the end of the cursor result set
Link: None
Function: SQL 8 - Reverts to ver 7 behavior of closing nonstatic cursors regardless of the SET CURSOR_CLOSE_ON_COMMIT state
Link: None
Function: Helps in gathering more information in full text search by turning on full text tracing which gathers information on indexing process using the error log. Also 7603, 7604, 7605 trace flags.
Link: https://connect.microsoft.com/SQLServer/feedback/details/526343/looking-for-documentation-on-trace-flags-7601-7603-7604-and-7605
Function: Performance fix for slow full text population with a composite clustered index
Link: None
Function: SQL 9 - Search results are missing when performing a full-text search operation on Win SharePoint Services 2.0 site after upgrading
Link: None
Function: SQL 9 - Full-text index population for the indexed view is very slow
Link: None
Function: SQL 10 - Avoids blocking when using full text indexing.
An issue we experienced that full text can be slow when there is a high number of updates to the index and is caused by blocking on the docidfilter internal table.
Link: None
Function: Forces Query Store to not flush data to disk on database shutdown.
Note: Using this trace may cause Query Store data not previously flushed to disk to be lost in case of shutdown.
For a SQL Server shutdown, the command SHUTDOWN WITH NOWAIT can be used instead of this trace flag to force an immediate shutdown.
Link: Docs Trace Flags
Link: Query Store Trace Flags
Scope: global only
Function: Enables asynchronous load of Query Store.
Note: Use this trace flag if SQL Server is experiencing high number of QDS_LOADDB waits related to Query Store synchronous load (default behavior).
Note: Starting with SQL Server 2019 this behavior is controlled by the engine and trace flag 7752 has no effect.
Link: Docs Trace Flags
Link: Query Store Trace Flags
Link: Let’s talk about trace flags
Scope: global only
Function: Enables a dedicated administrator connection (DAC) on SQL Server Express.
By default, no DAC resources are reserved on SQL Server Express.
Link: Docs Trace Flags
Link: https://msdn.microsoft.com/en-us/library/ms189595.aspx
Link: https://sqlperformance.com/2012/08/sql-memory/test-your-dac-connection
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-7806/
Scope: global only
Function: Disable Connectivity ring buffer
Link: http://blogs.msdn.com/b/sql_protocols/archive/2008/05/20/connectivity-troubleshooting-in-sql-server-2008-with-the-connectivity-ring-buffer.aspx
Function: Record connection closure info in ring buffer
Link: http://blogs.msdn.com/b/sql_protocols/archive/2008/05/20/connectivity-troubleshooting-in-sql-server-2008-with-the-connectivity-ring-buffer.aspx
Link: https://connect.microsoft.com/SQLServer/feedback/details/518158/-packet-error-a-fatal-error-occurred-while-reading-the-input-stream-from-the-network
Function: SQL 2012 SP2 CU8 introduced a fix for a “silent error” condition in the sqlcmd tool. The CU also included this flag to allow customers to revert to pre-CU fix behavior.
Link: https://support.microsoft.com/help/3082877/
Function: Khen2005, p2: “For SQL Server 2005, the SQL Server product team opted not to include some wait types that fall under one of the following three categories:
Function: Changes CPU Affinity behaviour
Link: https://blogs.msdn.microsoft.com/psssql/2011/11/11/sql-server-clarifying-the-numa-configuration-information
Function: SQL server to create a mini-dump once you enable 2551 and a out of memory condition is hit
Link: https://connect.microsoft.com/SQLServer/feedback/details/342691/not-enough-memory-was-available-for-trace-error-when-attempting-to-profile-sql-2008
Undocumented trace flag
Function: Force the scheduler hint to be ignored.
Always assign to the scheduler with the least load (pool based on SQL 2012 EE SKU or Load Factor for previous versions and SKUs.)
Link: How It Works: SQL Server 2012 Database Engine Task Scheduling
Link: https://blogs.msdn.microsoft.com/psssql/2013/08/13/how-it-works-sql-server-2012-database-engine-task-scheduling
Link: http://www.stillhq.com/sqldownunder/archives/msg05089.html
Undocumented trace flag
Function: Enables the “idle state behavior” (see IO Basics, Chapter 2 document) that a SQL instance can enter under certain conditions.
Link: https://technet.microsoft.com/en-us/library/cc917726.aspx
Function: Disables the “idle state” behavior that a SQL instance can enter (see TF 8009). Fixes problem that SQL Server services can not be stopped
Link: https://support.microsoft.com/help/2633271
Link: https://technet.microsoft.com/en-us/library/cc917726.aspx
Function: Trace flag 8011 disables the collection of additional diagnostic information for Resource Monitor.
You can use the information in this ring buffer to diagnose out-of-memory conditions.
Trace flag 8011 always applies across the server and has global scope. You can turn on trace flag 8011 at startup or in a user session.
Link: KB920093
Link: Docs Trace Flags
Link: http://www.sqlservergeeks.com/sql-server-ring-buffer-trace-flag-8011/
Scope: global only
Function: Disable the ring buffer for schedulers.
SQL Server records an event in the schedule ring buffer every time that one of the following events occurs:
a scheduler switches context to another worker, a worker is suspended, a worker is resumed, a worker enters the preemptive mode or the non-preemptive mode.
You can use the diagnostic information in this ring buffer to analyze scheduling problems.
For example, you can use the information in this ring buffer to troubleshoot problems when SQL Server stops responding.
Trace flag 8012 disables recording of events for schedulers. You can turn on trace flag 8012 only at startup.
The exception ring buffer records the last 256 exceptions that are raised on a node.
Each record contains some information about the error and contains a stack trace. A record is added to the ring buffer when an exception is raised.
Link: KB920093
Link: Docs Trace Flags
Link: http://www.sqlservergeeks.com/sql-server-ring-buffer-trace-flag-8012/
Scope: global only
Function: Disable auto-detection and NUMA setup
Link: Docs Trace Flags
Link: http://sql-sasquatch.blogspot.se/2013/04/startup-trace-flags-i-love.html
Link: Upgrading an expired SQL Server 2016 Evaluation Edition
Scope: global only
Undocumented trace flag
Function: Force load balancing to be ignored. Always assign to the preferred scheduler.
Link: How It Works: SQL Server 2012 Database Engine Task Scheduling
Function: Upgrade version conflict
Link: http://social.msdn.microsoft.com/Forums/eu/sqlexpress/thread/dd6fdc16-9d8d-4186-9549-85ba4c322d10
Link: http://connect.microsoft.com/SQLServer/feedback/details/407692/indicateur-de-trace-8017-reported-while-upgrading-from-ssee2005-to-ssee2008
Link: http://dba.stackexchange.com/questions/48580/trace-flag-and-which-need-to-be-turned-off-and-why
Function: Disables the creation of the ring buffer, and no exception information is recorded.
Disabling the exception ring buffer makes it more difficult to diagnose problems that are related to internal server errors.
Link: KB920093
Link: Docs Trace Flags
Link: http://www.sqlservergeeks.com/sql-server-ring-buffer-trace-flag-8018/
Link: http://www.sqlservergeeks.com/sql-server-ring-buffer-trace-flag-8019/
Scope: global only
Function: Disable stack collection for the exception ring buffer
Disables stack collection during the record creation.
Trace flag 8019 has no effect if trace flag 8018 is turned on.
Link: KB920093
Link: Docs Trace Flags
Link: http://www.sqlservergeeks.com/sql-server-ring-buffer-trace-flag-8019/
Scope: global only
Function: Disable working set monitoring.
SQL Server uses the size of the working set when SQL Server interprets the global memory state signals from the operating system.
Trace flag 8020 removes the size of the working set from consideration when SQL Server interprets the global memory state signals.
If you use this trace flag incorrectly, heavy paging occurs, and the performance is poor.
Therefore, contact Microsoft Support before you turn on trace flag 8020.
Link: KB920093
Link: Docs Trace Flags
Scope: global only
Function: On some lower end hardware we used to get reported that each CPU has its own NUMA node.
This was usually incorrect and when we detected only a single CPU per NODE we would assume NO NUMA.
Trace flag 8021 disables this override.
Link: https://blogs.msdn.microsoft.com/psssql/2011/11/11/sql-server-clarifying-the-numa-configuration-information/
Function: This flag gives more information about the conditions when a non-yielding scheduler/situation was encountered.
The whitepaper linked to on the right gives example output for this flag
Link: None
Function: When this TF is on, it affects the mini-dump generation logic for the 1788* errors: "To capture a mini-dump, one of the following checks must also be met.
Function: SQL on NUMA normally does most of its allocation on Node 1, because usually Windows and other programs will allocate from Node 0. However, if
you want SQL to do its resource allocation on the default node (node 0), turn on this flag.
Link: https://blogs.msdn.microsoft.com/psssql/2011/11/11/sql-server-clarifying-the-numa-configuration-information
Function: SQL Server will clear a dump trigger after generating the dump once
Link: KB917825
Link: Controlling SQL Server memory dumps
Function: Fix for performance bug
Link: https://support.microsoft.com/help/917035
Function: Alters cache limit settings
Warning: Trace flag 8032 can cause poor performance if large caches make less memory available for other memory consumers, such as the buffer pool.
Link: Docs Trace Flags
Link: SQL Server Plan Cache Limits
Link: KB2964518
Scope: global only
Function: Suppresses messages of the form “The time stamp counter of CPU on scheduler id 1 is not synchronized with other CPUs” from being placed in the SQL Error log when CPU drift is noticed
Warning: SQL 9 - Disable the reporting of CPU Drift errors in the SQL Server error log like time stamp counter of CPU on scheduler id 1 is not synchronized with other CPUs.
Link: https://support.microsoft.com/help/931279/
Link: https://blogs.msdn.microsoft.com/psssql/2007/08/19/sql-server-2005-rdtsc-truths-and-myths-discussed
Function: Will drastically reduce the number of context switches when running SQL 2005 or 2008
Link: KB972767
Link: http://forum.proxmox.com/threads/15844-Win7-x64-guest-with-SQLServer-2012-High-CPU-usage
Link: TECHNET List Of SQL Server Trace Flags
Function: Disables Resource Governor
Link: http://www.sqlservergeeks.com/blogs/AmitBansal/sql-server-bi/64/sql-server-disabling-resource-governor-permanently-somewhat
Note: Beginning with SQL Server 2014 SP2 and SQL Server 2016 this behavior is controlled by the engine and trace flag 8048 has no effect.
Function: Converts NUMA partitioned memory objects into CPU partitioned
Link: http://sql-sasquatch.blogspot.se/2013/04/startup-trace-flags-i-love.html
Link: https://support.microsoft.com/help/2809338
Link: http://blogs.msdn.com/b/psssql/archive/2012/12/20/how-it-works-cmemthread-and-debugging-them.aspx
Link: Docs Trace Flags
Link: http://blogs.msdn.com/b/psssql/archive/2011/09/01/sql-server-2008-2008-r2-on-newer-machines-with-more-than-8-cpus-presented-per-numa-node-may-need-trace-flag-8048.aspx
Link: Hidden Performance & Manageability Improvements in SQL Server 2012 / 2014
Link: KB2964518
Related to: 8015, 9024
Scope: global only
Function: SQL 9+ Startup only – Allows use of 1ms times even when patched. Check 8038 for details.
Link: KB972767
Link: https://blogs.msdn.microsoft.com/psssql/2010/08/18/how-it-works-timer-outputs-in-sql-server-2008-r2-invariant-tsc
Function: Causes "optional" wait types (see the CSS article) to be excluded when querying sys.dm_os_wait_stats
Link: https://blogs.msdn.microsoft.com/psssql/2009/11/02/the-sql-server-wait-type-repository/
Function: Enables a fix (after applying the appropriate CU) for x64 VAS exhaustion.
Assume that you install the 64-bit version of Microsoft SQL Server 2014, 2016 or 2017 on a computer that's running Windows Server 2012 or an earlier version of Windows operating system.
When SQL Server uses up all the user-mode virtual address space, you may receive an out of memory error message in the SQL Server error log.
Additionally, queries take a long time to finish execution, and the SOS_MEMORY_TOPLEVELBLOCKALLOCATOR
wait occurs.
Link: https://support.microsoft.com/help/3074434/
Link: KB2964518
Scope: global only
Function: Allows SQL Server 2014 SP2 to interrogate the hardware layout and automatically configure Soft-NUMA on systems reporting 8 or more CPUs per NUMA node.
The automatic Soft-NUMA behavior is Hyperthread (HT/logical processor) aware.
The partitioning and creation of additional nodes scales background processing by increasing the number of listeners, scaling and network and encryption capabilities.
When Trace Flag 8079 is enabled during startup, SQL Server 2012 SP4 will interrogate the hardware layout and automatically configure Soft NUMA on systems reporting 8 or more CPUs per NUMA node.
It is recommended to first test the performance of workload with Auto-Soft NUMA before it is turned ON in production.
Note: This trace flag applies to SQL Server 2014 SP2 and SQL Server 2012 SP4. Beginning with SQL Server 2016 this behavior is controlled by the engine and trace flag 8048 has no effect.
Link: KB972767
Link: Docs Trace Flags
Link: https://blogs.msdn.microsoft.com/sqlreleaseservices/sql-server-2012-service-pack-4-sp4-released/
Link: Hidden Performance & Manageability Improvements in SQL Server 2012 / 2014
Link: KB2964518
Scope: global only
Function: Enables a spinlock contention fix for high-end systems running SQL Server 2019 (15.x) serving many concurrent users.
Note: This trace flag applies to SQL Server 2019 (15.x) CU2 and higher builds.
Link: https://support.microsoft.com/kb/4538688
Scope: global only
Function: Used to replicate UPDATE
as DELETE/INSERT
pair at the publisher. i.e. UPDATE commands at the publisher can be run as an "on-page DELETE/INSERT" or a "full DELETE/INSERT".
If the UPDATE command is run as an "on-page DELETE/INSERT," the Logreader send UDPATE command to the subscriber,
If the UPDATE command is run as a "full DELETE/INSERT," the Logreader send UPDATE as DELETE/INSERT Pair.
If you turn on trace flag 8202, then UPDATE commands at the publisher will be always send to the subscriber as DELETE/INSERT pair.
Link: None
Function: Display statement and transaction locks on a deadlock error
Link: None
Function: SQL 8 - Supports stored procedure execution with a user specified owner name for SQL Server subscribers or without owner qualification for heterogeneous subscribers
Link: None
Function: Enables singleton updates for Transactional Replication. Updates to subscribers can be replicated as a DELETE and INSERT pair.
This might not meet business rules, such as firing an UPDATE trigger. With trace flag 8207 an update to a unique column that affects only one row (a singleton update) is replicated as an UPDATE and not as a DELETE or INSERT pair.
If the update affects a column on which has a unique constraint or if the update affects multiple rows, the update is still replicated as a DELETE or INSERT pair.
Link: https://blogs.msdn.microsoft.com/psssql/2009/11/02/the-sql-server-wait-type-repository/
Link: Docs Trace Flags
Scope: global only
Function: Output extra information to error log regarding replication of schema changes in SQL Server Replication
Link: None
Function: Determine whether trace flag to bypass proc generation has been set.
Referenced in the system procedure [master].[sys].[sp_cdc_vupgrade]
Link: None
Function: Creates a secondary index on the identifying columns on the change tracking side table at enable time
Link: https://social.msdn.microsoft.com/forums/sqlserver/en-US/00250311-7991-47b0-b788-7fae2e102254/trace-flag-8295
Link: https://support.microsoft.com/help/2476322/
Link: https://www.brentozar.com/archive/2014/06/performance-tuning-sql-server-change-tracking
Link: https://blogs.technet.microsoft.com/smartinez/2013/03/06/sql-server-for-configmgr-2012-ebook-and-top-10-database-issues
Thanks to: Wilfred van Dijk
Function: Databases in SQL 8 do not have a Service Broker ID. If you restore these databases on SQL 9 by using the WITH NORECOVERY option, these databases will not be upgraded causing mirroring & log-shipping configurations to fail.
Link: https://support.microsoft.com/help/959008
Function: Writes detailed information about Ms-DTC context & state changes to the log
Link: None
Function: Allows you to use a save-point within a distributed transaction
Link: None
Function: This trace flag is used to ignore all the index hints specified in query or stored procedure.
We can use this trace flag to troubleshooting the query performance without changing index hints.
Link: http://download.microsoft.com/download/6/e/5/6e52bf39-0519-42b7-b806-c32905f4a066/eim_perf_flowchart_final.pdf
Link: http://sqlblog.com/blogs/kalen_delaney/archive/2008/02/26/lost-without-a-trace.aspx
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-8602/
Scope: global only
Demo: https://github.com/ktaranov/sqlserver-kit/blob/master/Scripts/Trace_Flag/Trace_Flag_8602.sql
Undocumented trace flag
Function: Displays logical and physical trees used during the optimization process
Link: More Undocumented Query Optimizer Trace Flags
Link: Yet another X-Ray for the QP
Link: Query Optimizer Deep Dive - Part 4
Link: Query Optimizer Deep Dive - Part 1
Scope: session or query
Undocumented trace flag
Function: Show LogOp Trees
Link: Cardinality Estimation Framework 2014 First Look
Link: Yet another X-Ray for the QP
Link: Query Optimizer Deep Dive - Part 4
Function: Displays the optimization output tree during the optimization process (Before Post Optimization Rewrite).
Link: Internals of the Seven SQL Server Sorts – Part 1
Link: More Undocumented Query Optimizer Trace Flags
Link: Yet another X-Ray for the QP
Link: Query Optimizer Deep Dive - Part 4
Link: Few Outer Rows Optimization
Scope: session only
Function: Shows the initial Memo structure
Link: http://www.queryprocessor.ru/optimizer-part-3-full-optimiztion-optimization-search0
Link: http://www.benjaminnevarez.com/2012/04/inside-the-query-optimizer-memo-structure
Link: Query Optimizer Deep Dive – Part 3
Link: Query Optimizer Deep Dive - Part 4
Function: PWhite: “Task and operation type counts”.
Link: Query Optimizer Deep Dive - Part 4
Link: http://www.queryprocessor.ru/good-enough-plan
Scope: session only
Function: Add Extra Info to the Trees Output
Link: Cardinality Estimation Framework 2014 First Look
Link: Hello Operator, My Switch Is Bored
Undocumented trace flag
Function: Display the final memo structure
Link: http://www.benjaminnevarez.com/2012/04/inside-the-query-optimizer-memo-structure/
Link: http://www.somewheresomehow.ru/optimizer-part-3-full-optimiztion-optimization-search0/
Link: A Row Goal Riddle
Scope: session only
Undocumented trace flag
Function: Show Applied Transformation Rules
Link: https://www.sql.kiwi/2013/02/incorrect-results-with-indexed-views.html
Link: Cardinality Estimation Framework 2014 First Look
Link: Yet another X-Ray for the QP
Link: A Row Goal Riddle
Scope: session only
Undocumented trace flag
Function: Add memo arguments to trace flag 8619
Link: Query Optimizer Deep Dive - Part 4
Link: Yet another X-Ray for the QP
Link: A Row Goal Riddle
Scope: session only
Undocumented trace flag
Function: Rule with resulting tree
Link: Query Optimizer Deep Dive - Part 4
Link: Yet another X-Ray for the QP
Link: A Row Goal Riddle
Scope: session only
Undocumented trace flag
Function: When used with TF 8666, causes extra information about the transformation rules applied to be put into the XML showplan.
Link: Yet another X-Ray for the QP
Function: PWhite: “Enable prefetch (CUpdUtil::FPrefetchAllowedForDML and CPhyOp_StreamUpdate::FDoNotPrefetch)”
Link: Optimizing T-SQL queries that change data
Undocumented trace flag
Function: Set Cost Threshold for parallelism from 1 to 0, Forcing a Parallel Query Execution Plan.
Possible drawbacks: you'll run out of worker threads (if max worker threads is at default value) and unintentionally reduce DOP for queries that could really use parallelism.
Also be queries that looked fine with a serial merge join that, with a parallel merge join now have an order-preserving repartition streams and their performance will go to crap.
In the new version of SQL Server 2017 there is one more way to force parallel plan, that involves using the undocumented hint ENABLE_PARALLEL_PLAN_PREFERENCE
.
Link: https://www.sql.kiwi/2011/12/forcing-a-parallel-query-execution-plan.html
Link: https://www.sqlshack.com/sql-server-2017-how-to-get-a-parallel-plan/
Link: What You Need to Know about the Batch Mode Window Aggregate Operator in SQL Server 2016: Part 1
Link: Few Outer Rows Optimization
Link: Next-Level Parallel Plan Forcing: An Alternative to 8649
Link: https://logicalread.com/2015/10/30/sql-server-query-parallelizing-mc11/
Link: https://twitter.com/erikdarlingdata/status/1233449807907303425
Scope: global or session or query
Undocumented trace flag
Function: Disables local/global aggregation.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Included in execution plans are the names of the stats it used to come up with the plan.
Using a bit o' XML magic and over time, it allows you to clearly identify which stats are actually in use so that you can delete unused stats.
CQScanPartitionSortNew is one of only two sort classes that sets the Soft Sort property exposed when Sort operator execution plan properties are generated with undocumented trace flag 8666 enabled
Link: Internals of the Seven SQL Server Sorts – Part 1
Link: Yet another X-Ray for the QP
Link: https://blogfabiano.com/2012/07/03/statistics-used-in-a-cached-query-plan
Link: http://dataidol.com/davebally/2014/04/12/reasons-why-your-plans-suck-no-56536
Link: https://www.mssqltips.com/sqlservertip/4269/how-to-identify-useful-sql-server-table-statistics/
Link: http://sql-sasquatch.blogspot.com/2018/06/harvesting-sql-server-trace-flag-8666.html
Link: https://sql-sasquatch.blogspot.com/2018/12/fun-with-sql-server-plan-cache-trace.html
Link: Fun with SQL Server Plan Cache, Trace Flag 8666, and Trace Flag 2388
Scope: global or session
Undocumented trace flag
Function: According to Dimitriy Pilugin, disables the logic that prunes the memo and prevents the optimization process from stopping due to “Good Enough Plan found”.
Can significantly increase the amount of time, CPU, and memory used in the compilation process
Link: http://www.queryprocessor.ru/optimizer_unleashed_2
Function: Displays the query optimization phases for a specific optimization
Link: More Undocumented Query Optimizer Trace Flags
Link: Query Optimizer Deep Dive – Part 3
Link: https://sqlperformance.com/2013/06/sql-indexes/recognizing-missed-optimizations
Undocumented trace flag
Function: Skips “Search 1” phase of query optimization, and only Search 0 and Search 2 execute.
Link: https://sqlbits.com/Sessions/Event12/Query_Optimizer_Internals_Traceflag_fun
Undocumented trace flag
Function: For one query this changed a bushy plan to a left deep one. There was no change in cost. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Prevents the SQL Server optimizer from using a Hash Match Team operator
Link: None
Undocumented trace flag
Function: Prevents the SQL Server optimizer from using a Hash Match Team operator
Link: None
Undocumented trace flag
Function: Disables parallel scans.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Disable the spool on the inner side of nested loop.
Spools improve performance in majority of the cases. But it’s based on estimates.
Sometimes, this can be incorrect due to unevenly distributed or skewed data, causing slow performance.
But in vast majority of situations, you don’t need to manually disable spool with this trace flag.
Link: https://blogs.msdn.microsoft.com/psssql/2015/12/15/spool-operator-and-trace-flag-8690/
Link: http://dba.stackexchange.com/questions/52552/index-not-making-execution-faster-and-in-some-cases-is-slowing-down-the-query
Link: http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=453982
Link: Nested Loops Joins and Performance Spools
Scope: ?
Undocumented trace flag
Function: 'performance spool' optimization to the RegEx execution, reduces the number of executions of the RegEx function.
Link: Splitting Strings Based on Patterns
Link: Nested Loops Joins and Performance Spools
Scope: ?
Function: Force optimizer to use an Eager Spool for Halloween Protection
Link: http://www.sqlperformance.com/2013/02/sql-plan/halloween-problem-part-4
Link: https://sqlperformance.com/2016/03/sql-plan/changes-to-a-writable-partition-may-fail
Function: In SQL 2000, apparently would show IO prefetch on loop joins and bookmarks. I (Aaron) was unable to replicate the query plan behavior on SQL 2012 using the same test, so this flag may be obsolete.
Link: http://www.hanlincrest.com/SQLServerLockEscalation.htm
Function: In SQL 2000, apparently would have the same effect as OPTION(KEEPFIXED PLAN)
Link: http://www.hanlincrest.com/SQLserverStoredProcRecompiles.htm
Function: Reports to the error log when auto-update statistics executes
Link: https://support.microsoft.com/help/195565
Link: Docs Trace Flags
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-8721/
Scope: global only
Function: Disable all hints except locking hints
Link: http://sqlmag.com/sql-server/investigating-trace-flags
Function: (Apparently) disables an optimization where rows are sorted before a Key Lookup operator. (The optimization is meant to promote Sequential IO rather than the random nature of IO from Key Lookups).
Note that the context in which this flag is described means that the above description may not be very precise, or even the only use of this flag.
Link: https://answers.sqlperformance.com/questions/603/why-is-the-sort-operator-needed-in-this-plan.html
Function: Group Optimization Information
Link: http://www.queryprocessor.ru/good-enough-plan
Undocumented trace flag
Function: Resulted in a different join order for some queries with a higher estimated cost. Perhaps this disables Transitive Predicates? Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Resulted in a different join order for some queries. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Disable SM join.
Link: New Undocumented Trace Flags
Scope: ?
Function: Disable pre-fetching for the Nested Loop operator.
WARNING: Incorrect use of this trace flag may cause additional physical reads when SQL Server executes plans that contain the Nested Loops operator.
Link: KB920093
Link: Docs Trace Flags
Link: https://www.sql.kiwi/2013/03/execution-plan-analysis-the-mystery-work-table.html
Link: https://connect.microsoft.com/SQLServer/feedback/details/780194/make-dbcc-trace-flags-available-as-option-querytraceon
Scope: global or session
Function: Whatever else it does, one effect is to disable the “rowset sharing” optimization described in the 2 PWhite posts.
Link: https://sqlperformance.com/2016/03/sql-plan/changes-to-a-writable-partition-may-fail
Undocumented trace flag
Function: Skips search 0 optimization phase and moves to search 1.
Link: New Undocumented Trace Flags
Scope: ?
Function: Disable all locking hints
Link: http://sqlmag.com/sql-server/investigating-trace-flags
Function: Skip trivial plan optimization and force a full optimization
Link: More Undocumented Query Optimizer Trace Flags
Link: Query Optimizer Deep Dive - Part 1
Scope: session or query
Function: “A [workaround to the MERGE bug described] is to apply Trace Flag 8758 –unfortunately this disables a number of optimisations, not just the one
above, so it’s not really recommended for long term use.” “Disable rewrite to a single operator plan (CPhyOp_StreamUpdate::PqteConvert)”
Link: https://www.sql.kiwi/2010/08/another-interesting-merge-bug.html
Link: Optimizing T-SQL queries that change data
Undocumented trace flag
Function: Detect and write part of the query to the error log when it has been autoparameterized.
Link: https://github.com/ktaranov/sqlserver-kit/issues/146#issue-358855110
Scope: ?
Function: Allows use of variable length data, from ODBC driver; fixes the issue of a field returning the wrong data length
Link: http://jacob.steelsmith.org/content/sql-server-and-ole-db
Scope: global or session
Function: Give the optimizer more time to find a better plan
Link: http://www.queryprocessor.ru/optimizer_unleashed_1
Link: http://www.sqlservice.se/sql-server-trace-flag-8780/
Scope: global or session
Function: Allows DELETE, INSERT, and UPDATE statements to honor the SET ROWCOUNT ON setting when enabled
Link: None
Function: PWhite: “Undocumented trace flag 8790 forces a wide update plan for any data-changing query (remember that a wide update plan is always possible)”
Link: https://support.microsoft.com/help/956718/
Link: https://www.sql.kiwi/2012/12/merge-bug-with-filtered-indexes.html
Link: https://sqlperformance.com/2014/06/sql-plan/filtered-index-side-effect
Function: PWhite: “Disable DML Request Sort (CUpdUtil::FDemandRowsSortedForPerformance)”
Link: Optimizing T-SQL queries that change data
Link: https://sqlperformance.com/2014/10/t-sql-queries/performance-tuning-whole-plan
Undocumented trace flag
Function: Forces unordered scans.
Link: New Undocumented Trace Flags
Scope: ?
Function: Extended Page Heap Activities.
Referenced in passing in the CSS article in relation to debugging memory scribbler problems.
Link: https://blogs.msdn.microsoft.com/psssql/2012/11/12/how-can-reference-counting-be-a-leading-memory-scribbler-cause/
Function: Logs every two-digit year conversion to a four-digit year
Link: None
Function: Enables new (in 7.0) code to correct a problem with the SHRINK command and empty text or image extents
Link: None
Function: Allows SQL Server to use a specific API (SetFileIoOverlappedRange) when Locked Pages in Memory is enabled.
Link: https://blogs.msdn.microsoft.com/psssql/2012/03/20/setfileiooverlappedrange-can-lead-to-unexpected-behavior-for-sql-server-2008-r2-or-sql-server-2012-denali
Link: https://support.microsoft.com/help/2679255/
Link: https://blogs.msdn.microsoft.com/psssql/2013/10/16/every-time-i-attach-database-sql-logs-error-1314-for-setfileiooverlappedrange
Function: Converts a global log pool memory object into NUMA node partitioned memory object
Note: Beginning with SQL Server 2012 SP3 and SQL Server 2014 SP1 this behavior is controlled by the engine and trace flag 9024 has no effect.
Link: https://support.microsoft.com/help/2809338
Link: Docs Trace Flags
Link: KB2964518
Scope: global only
Related to: 8048
Function: “FIX: The compile time for a query that uses at least one outer join may be greater for SQL Server post-SP3 builds”
Link: None
Function: “FIX: Queries that join a view may run slowly if the view contains outer joins”
Link: None
Function: “FIX: SQL Server 2000 Service Pack 1 (SP1) and later builds may not generate an execution plan for a query, and you receive error message 8623”
Link: None
Function: “FIX: The performance of a DML operation that fires a trigger may decrease when the trigger execution plan recompiles repeatedly”
Link: None
Function: “FIX: A user-defined function returns results that are not correct for a query”
Link: None
Function: SQL 8 - Turns back behavior to SP3 after a SP4 installation, this allows to choose an index seek when comparing numeric columns or numeric constants that are of different precision or scale; else would have to change schema/code.
Link: None
Function: “FIX: Build 8.00.0837: A query that contains a correlated subquery runs slowly”
Link: None
Function: “FIX: Some complex queries are slower after you install SQL Server 2000 Service Pack 2 or SQL Server 2000 Service Pack 3”
Link: None
Function: “FIX: Query performance may be slower if the query contains both a GROUP BY clause and a DISTINCT keyword on the same column”
Link: None
Function: “FIX: The query plan may take longer than expected to compile, and you may receive error message 701, error message 8623, or error message 8651 in SQL Server 2000”
Link: None
Function: “FIX: A query may run more slowly against SQL Server 2000 post-SP3 hotfix build 8.00.0988 than a query that you run against SQL Server 2000 post-SP3 hotfix builds that are earlier than build 8.00.0988”
Link: None
Function: “FIX: The query performance may be slow when you query data from a view in SQL Server 2000”
Link: None
Function: SQL 9 - Stored procedure using views, perform slow compared to ver 8 if views use JOIN operator and contain sub queries
Link: None
Function: Used to workaround a problem with query notifications and restoring a DB with the NEW_BROKER option enabled.
Link: https://support.microsoft.com/help/2483090/
Undocumented trace flag
Function: Implemented a (SELECT 1) = 1 predicate as a join instead of optimizing it away.
Link: New Undocumented Trace Flags
Scope: ?
Function: PWhite: “Disable prefetch (CUpdUtil::FPrefetchAllowedForDML)” Dima: “Disables both [NLoop Implicit Batch Sort {TF 2340} and NL Prefetching {TF 8744}], and not only on the Post Optimization, but the explicit Sort also”
Link: Optimizing T-SQL queries that change data
Link: http://www.hanlincrest.com/SQLServerLockEscalation.htm
Link: http://www.queryprocessor.com/batch-sort-and-nested-loops
Undocumented trace flag
Function: Disables the particular copy out stage rewrite from Filter + (Scan or Seek) to (Scan or Seek) + Residual Predicate.
Enabling this flag retains the Filter in the final execution plan, resulting in a SQL Server 2008+ plan that mirrors the 2005 version.
Before Service Pack 3 of SQL Server 2012, we didn't have property Number of Rows Read
in execution plan, and to get a feel for the difference between the Number of Rows Read
and the Actual Number of Rows
, we'd need to use trace flag 9130.
Link: https://www.sql.kiwi/2012/10/cardinality-estimation-bug-with-lookups-in-sql-server-2008-onward.html
Link: http://sqlblogcasts.com/blogs/sqlandthelike/archive/2012/12/06/my-new-favourite-traceflag.aspx
Link: Hello Operator, My Switch Is Bored
Link: https://connect.microsoft.com/SQLServer/feedback/details/767395/cardinality-estimation-error-with-pushed-predicate-on-a-lookup
Link: http://www.theboreddba.com/Categories/FunWithFlags/Revealing-Predicates-in-Execution-Plans-(TF-9130).aspx
Link: https://sqlperformance.com/2016/06/sql-indexes/actual-rows-read-warnings-plan-explorer
Scope: global or session or query
Function: SQL 8 - Does additional reads to test if the page is allocated & linked correctly this checks IAM & PFS. Fixes error 601 for queries under Isolation level read uncommitted. In case performance is affected (because of a bug) apply SP4.
Link: https://support.microsoft.com/help/815008/
Function: “PRB: You receive error message 8623 when you try to run a query that joins multiple tables”
Link: None
Undocumented trace flag
Function: Disables HM (hash joins).
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Disable NL join and remove an index recommendation from a plan.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Resulted in a very strange cost change to a clustered index delete.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Resulted in a very strange cost change to a clustered index delete.
Link: New Undocumented Trace Flags
Scope: ?
Function: Cardinality estimates for literals that are outside the
histogram range are very low
Link: None
Related to: 9205
Undocumented trace flag
Function: Ccan be used to disable lazy index performance spools specifically.
You may still get a lazy table or row count spool instead (with or without sort optimization), depending on costing.
Link: Nested Loops Joins and Performance Spools
Scope: ?
Function: Output Statistics used by Query Optimizer. When enabled and a plan is compiled or recompiled there is a listing of statistics which is being fully loaded & used to produce cardinality and distribution estimates for some plan alternative or other.
Link: How to Find the Statistics Used to Compile an Execution Plan
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-9204/
Link: https://www.sqlpassion.at/archive/2013/10/29/fixing-cardinality-estimation-errors-with-filtered-statistics/
Scope: global or query
Related to: 9292
Function: Cardinality estimates for literals that are outside the histogram range are very low for tables that have parent-child relationships
Link: None
Related to: 9185
Function: Fixes that SQL Server underestimates the cardinality of a query expression and query performance may be slow
Link: None
Function: “FIX: Some queries that have a left outer join and an IS NULL filter run slower after you install SQL Server 2000 post-SP3 hotfix”
Link: None
Function: “FIX: A query filter condition that has a LEFT OUTER JOIN clause may cause an incorrect row count estimate in the query execution plan”
Link: None
Undocumented trace flag
Function: Resulted in a different join order for some queries. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Change in cardinality estimates for some queries. It might only work with the legacy CE. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Function: Disables Project Normalization step
Note: Please, don’t use TF 9259 that disables Project Normalization step in a real production system, besides it is undocumented and unsupported, it may hurt your performance.
Link: http://www.queryprocessor.com/sudf-ce/
Undocumented trace flag
Function: Adds an explicit sort before creation of an index spool. Almost doesn’t change the total estimated cost. Might be identical plans with just more detail shown at that step.
Link: New Undocumented Trace Flags
Scope: ?
Function: SQL 8 - When SQL Server runs a parameterized query that contains several IN clauses, each with a large number of values, SQL Server may return the following error message after a minute or more of high CPU utilization: KB 325658. Server: Msg 8623, Level 16, State 1. Internal Query Processor Error: The query processor could not produce a query plan. Contact your primary support provider for more information.
Link: None
Function: “FIX: A DML Operation on a Large Table Can Cause Performance Problems” Enables SQL 2000 optimizations that sort data in DML statements before the changes are applied to a clustered index
Link: None
Undocumented trace flag
Function: Changed the order of a scalar operator comparison in a single join for certain queries. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Appears to disable partial aggreation.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Effects around local and global aggregates - choose coerce partial and global aggregation over scalar aggregation.
Link: https://github.com/ktaranov/sqlserver-kit/issues/93
Scope: session only
Function: Output Statistics considered to be used by Query Optimizer
Link: How to Find the Statistics Used to Compile an Execution Plan
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-9292/
Scope: session only
Related to: 9204
Undocumented trace flag
Function: Resulted in a rather odd plan for a COUNT(DISTINCT) query against a CCI.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Appears to disable batch mode window aggregates.
Link: New Undocumented Trace Flags
Scope: ?
Function: Disables batch mode for sort operator. SQL Server 2016 introduces a new batch mode sort operator that boosts performance for many analytical queries.
Link: https://support.microsoft.com/help/3172787
Link: Docs Trace Flags
Link: Niko Neugebauer Columnstore Indexes – part 86
Scope: global or session or query
Function: Sets a row limit (based on cardinality estimates) that controls whether a bulk insert is attempted or not (assuming conditions are met for a bulk insert). Introduced as a workaround for memory errors encountered with bulk insert.
Link: https://support.microsoft.com/help/2998301/
Function: Disables batch mode for top N sort operator. SQL Server 2016 introduces a new batch mode top sort operator that boosts performance for many analytical queries.
Link: Docs Trace Flags
Link: Niko Neugebauer Columnstore Indexes – part 86
Link: https://support.microsoft.com/help/3172787
Scope: global or session or query
Undocumented trace flag
Function: Disable aggregate pushdown operations for columnstore indexes.
The number of rows aggregated at the level of the scan is displayed in the new property plan Actual Number Of Locally Aggregated Rows.
TF 9354 can be used to disable the push of aggregation, the difference can be observed by the runtime, according to the number of rows in the plan Actual Number Of Locally Aggregated Rows and number Actual Number Of Rows output from the scan operator.
Example:
use AdventureworksDW2016CTP3;
set nocount on;
go
-- Undocumented TF 9354 disables this optimization, run to see Aggregation Pushdown Performance Gain
set statistics xml, time on;
select count_big(*) from dbo.FactResellerSalesXL_CCI;
select count_big(*) from dbo.FactResellerSalesXL_CCI option(querytraceon 9354); -- undocumented/unsupported TF 9354 to disable aggregate pushdown
set statistics xml, time off;
Function: Disable batch mode sort operations in a complex parallel query. For example, this flag could apply if the query contains merge join operations.
Link: Niko Neugebauer Columnstore Indexes – part 86
Link: https://support.microsoft.com/help/3171555
Scope: global or session or query
Undocumented trace flag
Function: Very slightly changed the memory grant of a query with a batch mode window aggregate.
Link: New Undocumented Trace Flags
Scope: ?
Function: Enables additional dynamic memory grant for batch mode operators.
If a query does not get all the memory it needs, it spills data to TempDB, incurring additional I/O and potentially impacting query performance.
If the dynamic memory grant trace flag is enabled, a batch mode operator may ask for additional memory and avoid spilling to TempDB if additional memory is available.
For more information, see the Effects of min memory per query section of the Memory Management Architecture Guide.
Link: Niko Neugebauer Columnstore Indexes – part 86
Link: Docs Trace Flags
Scope: global or session
Undocumented trace flag
Function: Resulted in plan changes including parallelism for queries that shouldn’t have been eligible for parallelism based on CTFP. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Function: Apparently enables a fix for an access violation when a table with Japanese characters has an indexed changed.
Link: https://support.microsoft.com/help/3142595/
Link: https://support.microsoft.com/help/3138659/
Undocumented trace flag
Function: Disable adaptive join.
Link: SQL Server 2017: Adaptive Join Internals
Scope: ?
Undocumented trace flag
Function: Optimization adaptive threshold rows. The adaptive threshold to the minimum estimate.
Link: SQL Server 2017: Adaptive Join Internals
Scope: ?
Undocumented trace flag
Function: Fix slowly query runs when SQL Server uses hash aggregate in the query plan.
Link: https://support.microsoft.com/help/3167159/
Scope: ?
Undocumented trace flag
Function: Removes the new OptimizerStatsUsage information from estimated query plans.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Optimization adaptive join internals.
Link: SQL Server 2017: Adaptive Join Internals
Scope: ?
Undocumented trace flag
Function: Forces query plans to use the new referential integrity operator when validating UPDATE and DELETE queries against foreign key parent tables.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Disables the referential integrity operator.
Link: https://orderbyselectnull.com/2017/12/05/the-referential-integrity-operator/
Function: Disables Batch Mode in Parallel Columnstore query plans.
(Note that a plan using batch mode appears to require a recompile before the TF takes effect)
Sunil Agarwal also used this trace flag in demo scripts for a PASS 2014 session on column store indexing
Link: Niko Neugebauer Columnstore Indexes – part 35
Link: What You Need to Know about the Batch Mode Window Aggregate Operator in SQL Server 2016: Part 1
Function: Causes SQL Server to generate a plan using minimum selectivity for single-table filters, under the query optimizer cardinality estimation model of SQL Server 2014 (12.x) and later versions.
Starting with SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES' query hint instead of using this trace flag.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Note: This trace flag does not apply to CE version 70. Use trace flag 4137 instead.
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Link: Cardinality Estimation for Multiple Predicates
Scope: global or session or query
Undocumented trace flag
Function: Assumes independence for multiple WHERE predicates in the SQL 2014 cardinality estimation model.
Predicate independence was the default for versions prior to SQL Server 2014, and thus this flag can be used to more closely emulate pre-SQL 2014 cardinality estimate behavior in a more specific fashion than TF 9481.
Link: https://sqlperformance.com/2014/01/sql-plan/cardinality-estimation-for-multiple-predicates
Link: https://connect.microsoft.com/SQLServer/feedback/details/801908/sql-server-2014-cardinality-estimation-regression
Link: Cardinality Estimation for Multiple Predicates
Scope: global or session or query
Undocumented trace flag
Function: Allowing the outer join to keep a zero-row inner-side estimate (instead of raising to one row) (so all outer rows qualify) gives a 'bug-free' join estimation with either calculator.
If you're interested in exploring this, the undocumented trace flag is 9473 (alone).
Link: https://dba.stackexchange.com/a/141533/107045
Scope: ?
Undocumented trace flag
Function: Change in cardinality estimates for some joins in certain queries. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Function: Causes SQL Server to generate a plan using the Simple Containment assumption instead of the default Base Containment assumption, under the query optimizer cardinality estimation model of SQL Server 2014 through SQL Server 2016 versions.
Beginning with SQL Server 2016 SP1, to accomplish this at the query level, add the USE HINT query hint instead of using this trace flag.
Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.
Link: https://support.microsoft.com/help/3189675
Link: New Features in SQL Server 2016 Service Pack 1
Link: Docs Trace Flags
Scope: global or session or query
Undocumented trace flag
Function: Slight change in ratio of EstimateRebinds and EstimateRewinds was observed. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Change in cardinality estimates for some joins in certain queries. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Forces the optimizer to use Simple Join [estimation] even if a histogram is available.
Will force optimizer to use a simple join estimation algorithm, it may be CSelCalcSimpleJoinWithDistinctCounts, CSelCalcSimpleJoin or CSelCalcSimpleJoinWithUpperBound, depending on the compatibility level and predicate comparison type.
Link: Statistics and Cardinality Estimation
Scope: ?
Undocumented trace flag
Function: Reduced the selectivity of a bitmap filter from 0.001 to 0.000001. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Function: Enables you to set the query optimizer cardinality estimation model to the SQL Server 2012 and earlier version independent of the compatibility level of the database.
To accomplish this at the database level, see ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).
To accomplish this at the query level, add the QUERYTRACEON query hint.
Link: New Features in SQL Server 2016 Service Pack 1
Link: https://sqlserverscotsman.wordpress.com/2016/11/28/a-guide-on-forcing-the-legacy-ce/
Link: Docs Trace Flags
Link: KB2801413
Link: http://www.sqlservergeeks.com/sql-server-2014-trace-flags-9481/
Link: https://sqlperformance.com/2019/01/sql-performance/compatibility-levels-and-cardinality-estimation-primer
Link: KB2801413
Link: Cardinality Estimation for Multiple Predicates
Scope: global or session or query
Undocumented trace flag
Function: Implements a “model variation” in the SQL 2014 cardinality estimator. The flag turns off the “overpopulated primary key” adjustment that the optimizer might use when determining that a “dimension” table (the schema could be OLTP as well) has many
more distinct values than the “fact” table. (The seminal example is where a Date dimension is populated out into the future, but the fact table only has rows up to the current date). Since join cardinality estimation occurs based on the contents of the
histograms of the joined columns, an “overpopulated primary key” can result in higher selectivity estimates, causing rowcount estimates to be too low.
Link: http://www.queryprocessor.com/ce_opk
Undocumented trace flag
Function: Implements a “model variation” in the SQL 2014 cardinality estimator. The flag will force the optimizer to create (if possible) a filtered statistics object based on a predicate in
the query. This filtered stat object is not persisted and thus would be extremely resource intensive for frequent compilations. In Dima’s example, the filtered stat object
is actually created on the join column...i.e. “CREATE STATISTICS [filtered stat obj] ON [table] (Join column) WHERE (predicate column = ‘literal’)”
Link: http://www.queryprocessor.com/ce_filteredstats
Undocumented trace flag
Function: Slight change in estimated number of rewinds. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Function: Disables SELECT permission for DBCC SHOW_STATISTICS
Link: https://support.microsoft.com/help/2683304
Link: Docs Trace Flags
Link: http://www.benjaminnevarez.com/2013/02/dbcc-show_statistics-works-with-select-permission
Scope: global only
Undocumented trace flag
Function: Implements a “model variation” in the SQL 2014 cardinality estimator. This flag reverts the estimation behavior for multi-statement TVFs back to 1 row (instead of the 100-row estimate behavior that was adopted in SQL 2014).
Link: http://www.queryprocessor.com/ce_mtvf
Undocumented trace flag
Function: Implements a “model variation” in the SQL 2014 cardinality estimator and turns off the new logic that handles ascending keys.
Link: http://www.queryprocessor.com/ce_asckey
Undocumented trace flag
Function: Change in cardinality estimate. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: The behaviour of the join cardinality estimation with CSelCalcExpressionComparedToExpression can also be modified to not account for `bId
with another undocumented variation flag (9494)
Link: https://dba.stackexchange.com/a/141533/107045
Scope: ?
Function: Disables parallelism during insertion for INSERT...SELECT operations and it applies to both user and temporary tables
Link: https://support.microsoft.com/help/3180087
Link: Docs Trace Flags
Scope: global or session
Function: SQL 11 CTP3 - to get more than 1 availability group replica in CTP3 Scope Startup
Link: http://connect.microsoft.com/SQLServer/feedback/details/682581/denali-hadron-read-only-routing-url-is-not-yet-implemente
Undocumented trace flag
Function: For AGs, “when enabled on the secondary ignores the redo target provided from the primary progress message and always set the redo target at the Max LSN value.”
Link: https://blogs.msdn.microsoft.com/alwaysonpro/2013/12/04/recovery-on-secondary-lagging-shared-redo-target
Function: Enables compression of the data stream for availability groups during automatic seeding.
Compression can significantly reduce the transfer time during automatic seeding and will increase the load on the processor.
Link: Docs Trace Flags
Link: https://www.mssqltips.com/sqlservertip/4537/sql-server-2016-availability-group-automatic-seeding/
Link: https://msdn.microsoft.com/en-us/library/mt735149.aspx
Link: Tune compression for availability group
Scope: global or session
Function: Disables Availability Groups Auto seeding to the default database path.
Link: https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/automatic-seeding-secondary-replicas
Scope: global or session
Function: Revert to the original (SQL Server 2016) implementation of database level health detection using TF 9576 as either a startup parameter or enabled using DBCC TRACEON command.
This new implementation is currently only available for SQL Server running on Windows and will be ported to SQL Server 2017 on Linux in an upcoming cumulative update.
Link: https://blogs.msdn.microsoft.com/sql_server_team/sql-server-availability-groups-enhanced-database-level-failover/
Scope: global only
Function: Disables log block compression in Always On Availability Groups.
Log block compression is the default behavior used with both synchronous and asynchronous replicas in SQL Server 2012 and SQL Server 2014.
In SQL Server 2016, compression is only used with asynchronous replica.
Link: Docs Trace Flags
Scope: global or session
Function: Enables log stream compression for synchronous availability groups.
This feature is disabled by default on synchronous availability groups because compression adds latency.
Link: Docs Trace Flags
Link: Tune compression for availability group
Scope: global or session
Undocumented trace flag
Function: Software Usage Metrics is disabled.
Link: Bad Idea Jeans: Finding Undocumented Trace Flags
Undocumented trace flag
Function: Unknown. Is turned on on SQL Server 2014 CTP1 standard installation in Windows Azure VM
Link: None
Undocumented trace flag
Function: Unknown. Is turned on on SQL Server 2014 CTP1 standard installation in Windows Azure VM
Link: None
Undocumented trace flag
Function: Unknown. Is turned on on SQL Server 2014 CTP1 standard installation in Windows Azure VM
Link: None
Undocumented trace flag
Function: Activate the trace flag before creating a natively compiled procedure.
If you now open up the SQL Server error log you should see the compilation process for the natively compiled procedure.
This is an undocumented trace flag so please don’t use this on a production system.
Link: https://web.archive.org/web/20160327221828/http://speedysql.com/2015/10/28/new-trace-flag-for-in-memory-oltp-hekaton/
Undocumented trace flag
Function: According to Bob Ward’s PASS 2014 talk on SQL Server IO, enables “extra tracing but massive output” for Hekaton checkpoint files.
Link: None
Undocumented trace flag
Function: Dumps more diagnostic stuff in the log.
Link: Bad Idea Jeans: Finding Undocumented Trace Flags
Undocumented trace flag
Function: For testing purposes, you might want to turn off automatic merging of files, so that you can more readily
explore this metadata. You can do that by turning on the undocumented trace flag 9851. And of course,
be sure to turn off the trace flag when done testing.
Link: http://gsl.azurewebsites.net/Portals/0/Users/dewitt/talks/HekatonWhitePaper.pdf
Function: Enables an update that reduces the “disk footprint [of In-Memory OLTP] by reducing the In-Memory checkpoint files to 1 MB (megabytes) each.”
Link: https://support.microsoft.com/help/3147012/
Function: Disables merge/recompress during columnstore index reorganization.
In SQL Server 2016, when a columnstore index is reorganized, there is new functionality to automatically merge any small compressed rowgroups into larger compressed rowgroups, as well as recompressing any rowgroups that have a large number of deleted rows.
Note: Trace flag 10204 does not apply to columnstore indexes which are created on memory-optimized tables.
Link: Docs Trace Flags
Link: Parallelism in Hekaton (In-Memory OLTP)
Scope: global or session
Function: In CTP2, enabled functionality for reading in-memory tables on a readable secondary
Link: https://connect.microsoft.com/SQLServer/feedback/details/795360/secondary-db-gets-suspect-when-i-add-in-memory-table-to-db-which-is-part-of-alwayson-availability-group
Undocumented trace flag
Function: Unknown. See article.
The formula to compute RT (Recompilation Thresholds) values is different when trace flag 2371 is enabled (or for versions and compatibility settings where the sublinear behaviour is default (if trace flag 9497 is off)). The new formula for RT is SQRT(1000 * table rows).
Link: Temporary Table Caching in Stored Procedures
Scope: ?
Undocumented trace flag
Function: According to demo scripts from a Sunil Agarwal session at PASS 2014, enables a new DMV named sys.dm_db_column_store_row_group_physical_stats.
This DMV is not in SQL 2014 RTM and Sunil did not perform this demo during the session, so this DMV appears to be in a future (or internal) version of SQL Server.
Link: None
Function: Disables merge/recompress during columnstore index reorganization.
In SQL Server 2016, when a columnstore index is reorganized, there is new functionality to automatically merge any small compressed rowgroups
into larger compressed rowgroups, as well as recompressing any rowgroups that have a large number of deleted rows.
Note: Trace flag 10204 does not apply to column store indexes which are created on memory-optimized tables.
Link: Docs Trace Flags
Link: Niko Neugebauer Columnstore Indexes – part 86
Scope: global or session or query
Function: When a Clustered Columnstore index has corrupted segments, turning on this flag suppresses errors 5288 and 5289 and allows a scan of a clustered columns store to skip corrupt segments and complete (though with results that do not include the corrupted segment(s)). This flag is helpful when attempting to copy-out data in a corrupt CCI.
Link: https://support.microsoft.com/help/3067257/
Link: https://blogs.msdn.microsoft.com/sqlreleaseservices/partial-results-in-a-query-of-a-clustered-columnstore-index-in-sql-server-2014
Undocumented trace flag
Function: Enables the option to configure compression delay in columnstore indexes in SQL Server 2016
Link: http://www.nikoport.com/2016/02/04/columnstore-indexes-part-76-compression-delay/
Scope: session only
Undocumented trace flag
Function: Polybase mode enabled for SqlComposable.
Link: Bad Idea Jeans: Finding Undocumented Trace Flags
Function: Enables creation of additional indexes on internal memory-optimized staging temporal table, beside the default one.
If you have specific query pattern that includes columns which are not covered by the default index you may consider adding additional ones.
Note: System-versioned temporal tables for Memory-Optimized Tables are designed to provide high transactional throughput.
Please be aware that creating additional indexes may introduce overhead for DML operations that update or delete rows in the current table.
With the additional indexes you should aim to find the right balance between performance of temporal queries and additional DML overhead.
Link: Docs Trace Flags
Link: https://support.microsoft.com/help/3198846
Link: https://blogs.msdn.microsoft.com/sqlcat/2016/12/08/improve-query-performance-on-memory-optimized-tables-with-temporal-using-new-index-creation-enhancement-in-sp1/
Scope: global or session
Undocumented trace flag
Function: Force stream Aggregates for scalar aggregation in batch mode.
Link: New Undocumented Trace Flags
Scope: ?
Undocumented trace flag
Function: Results in a different join order for some queries. Full effect unknown.
Link: New Undocumented Trace Flags
Scope: ?
Function: Disables the use of the last persisted sample rate, for all subsequent statistics update where a sample rate is not specified explicitly as part of the UPDATE STATISTICS statement.
Link: https://support.microsoft.com/help/4039284
Link: Docs Trace Flags
Scope: global or session
Function: In Microsoft SQL Server 2017, when incremental statistics are built on the top of partitioned tables, the sum of modification counts of all partitions is stored as the modification count of the root node.
When the modification count of the root node exceeds a threshold, the auto update of statistics is triggered.
However, if the modification count of any single partition does not exceed the local threshold, the statistics are not updated.
Additionally, the modification count of the root node is reset to zero. This may cause delay in the auto update of incremental statistics.
When trace flag 11024 is enabled, the modification count of the root node is kept as the sum of modification counts of all partitions.
Note: This trace flag applies to SQL Server 2016 (13.x) SP2, SQL Server 2017 (14.x) CU3, and higher builds.
Link: https://support.microsoft.com/help/4041811
Link: Docs Trace Flags
Scope: global or session
Undocumented trace flag
Function: Prevents new information about row goals from getting logged to the plan cache.
Link: New Undocumented Trace Flags
Scope: ?
Function: Applies the default timeout set by query wait (s)
or the Resource Governor REQUEST_MEMORY_GRANT_TIMEOUT_SEC
configuration to Columnstore index build operations.
Note: This trace flag applies to SQL Server 2016 (13.x) SP2 CU5, SQL Server 2017 (14.x) CU14, and higher builds.
Link: Docs Trace Flags
Link: https://support.microsoft.com/kb/4480641
Scope: global or session