Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
5633 lines (4339 sloc) 290 KB

Microsoft SQL Server Trace Flags

Detailed list of all discovered (documented and undocumented) Microsoft SQL Server trace flags (620 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:

  • Aaron Morelli (b | @sqlcrossjoin)
  • Steinar Andersen (b | @SQLSteinar)
  • Brent Ozar (b | @BrentO)
  • Yusuf Anis
  • Lars Utterström
  • Martin Höglund
  • Håkan Winther
  • Toine Rozemeijer
  • Robert L Davis (b | @SQLSoldier)
  • Lonny Niederstadt (b | @sql_handle)
  • Andrzej Kukuła
  • Alexander Titenko (gtihub)
  • Albert van der Sel
  • Amit Banerjee
  • Erin Stellato (b | @erinstellato)
  • Darik Hammer (b | @drayhammer)
  • Erik Darling (b)
  • Joe Obbish (b)
  • Glenn Berry (b | t)
  • Pedro Lopes (b | t)
  • Paul White (b | t)
  • Alexey Nagorskiy (github)
  • Niko Neugebauer (b | t)
  • Solomon Rutzky (b | t)
  • Jason Brimhall (b | t)
  • Victor Isakov (b)
  • Scott Caldwell (b | t)
  • Mike Fal (b | t)
  • Prince Kumar Rastogi (b | t)
  • Kendra Little (b | t)
  • Slava Oks (t)
  • John Sterrett (b)
  • Pavel Málek (t)
  • Andrew Pruski (b | t)
  • Josh Darnell (b | t)
  • Andrzej Kukula
  • Aaron Bertrand (b | t)
  • Wilfred van Dijk
  • Tracy Boggiano (b | t)

What are Microsoft SQL Server Trace Flags?

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.

How do I turn Trace Flags on and off?

  • You can use the DBCC TRACEON and DBCC TRACEOFF commands
  • You can use the -T option in the startup configuration for the SQL Server Service. 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.)
  • You can also use the hint QUERYTRACEON in your queries: <querytraceon_hint ::= {QUERYTRACEON trace_flag_number}>

How do I know what Trace Flags are turned on at the moment?

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

What Are the Optimizer Rules?

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.

Getting the List of Available Rules

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

Remarks

There are three scopes at which trace flags can work: query, session, and global.

  • Query trace flags are active for the context of a specific query
  • Session trace flags are active for a connection and are visible only to that connection
  • Global trace flags are set at the server level and are visible to every connection on the server.

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:

  • A global trace flag must be enabled globally. Otherwise, the trace flag has no effect. We recommend that you enable global trace flags at startup, by using the -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.
  • If a trace flag has either global, session or query scope, it can be enabled with the appropriate scope. A trace flag that is enabled at the session level never affects another session, and the effect of the trace flag is lost when the SPID that opened the session logs out.

Trace flags are set ON or OFF by using either of the following methods:

  • Using the DBCC TRACEON and DBCC TRACEOFF commands. For example, to enable the 2528 trace flag globally, use 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.
  • Using the -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.
  • At the query level, by using the QUERYTRACEON query hint. The QUERYTRACEON option is only supported for Query Optimizer trace flags documented in the Docs Trace Flags. However, this option will not return any error or warning if an unsupported trace flag number is used. If the specified trace flag is not one that affects a query execution plan, the option will be silently ignored. More than one trace flag can be specified in the OPTION clause if 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.

Unknown trace flags

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).

  • 2591
  • 3447 (but 3448 is there, which is supposed to help fix an issue with hung Mirrored databases)
  • 3978
  • 4141
  • 5521
  • 7838
  • 8037
  • 8054
  • 8057
  • 8063
  • 8065
  • 9041
  • 9537
  • 9570
  • 9883
  • 9905
  • 9934
  • 9940
  • 9941

Recommended Trace Flags

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.

Trace Flags List

Summary: 620 trace flags

Trace Flag: -1

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/

Trace Flag: 101

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/kb/2892633
Scope: Replication Merge Agent only

Trace Flag: 102

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/kb/2892633
Scope: Replication Merge Agent only

Trace Flag: 105

Undocumented trace flag
Function: Join more than 16 tables in SQL server 6.5
Link: SQL Server 6.5: Some Useful Trace Flag

Trace Flag: 106

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

Trace Flag: 107

Undocumented trace flag
Function: SQL 6.5/7/8 – Interprets numbers with a decimal point as float instead of decimal
Link: None

Trace Flag: 110

Undocumented trace flag
Function: SQL 6.5 – Turns off ANSI select characteristics
Link: None

Trace Flag: 120

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

Trace Flag: 139

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/kb/4010261
Link: Docs Trace Flags
Scope: global only

Trace Flag: 144

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

Trace Flag: 146

Undocumented trace flag
Function: Consider using when replaying against SQL 8.0, to avoid an attempt to set an encrypted connection.
Link: None

Trace Flag: 166

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: ?

Trace Flag: 168

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/kb/926292

Trace Flag: 174

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/kb/3026083/
Link: Docs Trace Flags
Link: SQL Server Plan Cache Limits
Link: KB2964518
Scope: global only

Trace Flag: 176

Function: Enables a fix to address errors when rebuilding partitions online for tables that contain a computed partitioning column.
Link: https://support.microsoft.com/kb/3213683/
Link: https://support.microsoft.com/kb/4541096/
Link: Docs Trace Flags
Scope: global or session

Trace Flag: 204

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: KB153096

Trace Flag: 205

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/kb/195565
Link: Docs Trace Flags
Scope: global only

Trace Flag: 206

Undocumented trace flag
Function: SQL 6.5 – Provides backward compatibility for the set user statement. KB 160732
Link: None

Trace Flag: 208

Undocumented trace flag
Function: SET QUOTED IDENTIFIER ON
Link: None

Trace Flag: 210

Function: SQL 9 – Error when you run a query against a view: "An error occurred while executing batch"
Link: https://support.microsoft.com/kb/945892

Trace Flag: 212

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

Trace Flag: 220

Undocumented trace flag
Function: “FIX: Error Message: "Insufficient key column information for updating" Occurs in SQL Server 2000 SP3”
Link: None

Trace Flag: 221

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

Trace Flag: 222

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

Trace Flag: 237

Undocumented trace flag
Function: Tells SQL Server to use correlated sub-queries in Non-ANSI standard backward compatibility mode
Link: None

Trace Flag: 242

Undocumented trace flag
Function: Provides backward compatibility for correlated subqueries where non-ANSI-standard results are desired
Link: None

Trace Flag: 243

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

Trace Flag: 244

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

Trace Flag: 246

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

Trace Flag: 253

Undocumented trace flag
Function: Prevents ad-hoc query plans to stay in cache
Link: http://www.sqlservercentral.com/Forums/Topic837613-146-1.aspx

Trace Flag: 257

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

Trace Flag: 260

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

Trace Flag: 262

Undocumented trace flag
Function: SQL 7 – Trailing spaces are no longer truncated from literal strings in CASE statements
Link: None

Trace Flag: 272

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

Trace Flag: 274

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 when IDENTITY_INSERT is set to OFF”
Link: None

Trace Flag: 302

Undocumented trace flag
Function: Output Index Selection info
Link: SQL Server 6.5: Some Useful Trace Flag

Trace Flag: 304

Undocumented trace flag
Function: Changed the reported CachedPlanSize.
Link: New Undocumented Trace Flags
Scope: ?

Trace Flag: 310

Undocumented trace flag
Function: Outputs info about actual join order
Link: SQL Server 6.5: Some Useful Trace Flag

Trace Flag: 320

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

Trace Flag: 323

Function: Outputs detailed info about updates
Link: SQL Server 6.5: Some Useful Trace Flag
Link: KB153096

Trace Flag: 325

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

Trace Flag: 326

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

Trace Flag: 330

Undocumented trace flag
Function: Enables full output when using the SET SHOWPLAN_ALL option, which gives detailed information about joins
Link: None

Trace Flag: 342

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

Trace Flag: 345

Undocumented trace flag
Function: Changes join order selection logic in SQL Server 6.5
Link: SQL Server 6.5: Some Useful Trace Flag

Trace Flag: 445

Undocumented trace flag
Function: Prints ”compile issued” message in the errorlog for each compiled statement, when used together with 3605
Link: None

Trace Flag: 460

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/kb/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/kb/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

Trace Flag: 506

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

Trace Flag: 610

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

Trace Flag: 611

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

Trace Flag: 617

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/

Trace Flag: 634

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/
Link: SQL Server 2019 Aggressive Clustered Columnstore Cleanup
Scope: global only

Trace Flag: 646

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

Trace Flag: 647

Function: Avoids a new-in-SQL 2012 data check (done when adding a column to a table) that can cause ALTER TABLE... ADD operations to take a very long time. The KB has a useful query for determining the row size for a table.
Link: https://support.microsoft.com/kb/2986423

Trace Flag: 652

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

Trace Flag: 653

Undocumented trace flag
Function: Disables read ahead for the current connection
Link: None

Trace Flag: 661

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/
Link: SQL Server 2019 Aggressive Clustered Columnstore Cleanup
Scope: global or session

Trace Flag: 662

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

Trace Flag: 669

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/kb/3027860

Trace Flag: 683

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

Trace Flag: 692

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

Trace Flag: 698

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

Trace Flag: 699

Undocumented trace flag
Function: Turn off transaction logging for the entire SQL dataserver
Link: None

Trace Flag: 670, 671

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

Trace Flag: 715

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

Trace Flag: 806

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: ?

Trace Flag: 809

Undocumented trace flag
Function: SQL 8 – Limits the amount of Lazy write activity
Link: None

Trace Flag: 815

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

Trace Flag: 818

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/kb/826433
Link: https://technet.microsoft.com/en-us/library/cc966500.aspx
Link: https://support.microsoft.com/kb/828339
Link: Important Trace Flags That Every DBA Should Know
Scope: global only

Trace Flag: 822

Undocumented trace flag
Function: A workaround for SQL 2000 over-committing memory on the machine
Link: None

Trace Flag: 825

Undocumented trace flag
Function: In SQL 2000, enables Buffer Pool support for NUMA. TF 888 must be used.
Link: None

Trace Flag: 828

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/kb/906121 Link: https://blogs.msdn.microsoft.com/psssql/2008/04/11/how-it-works-sql-server-checkpoint-flushcache-outstanding-io-target/

Trace Flag: 830

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/kb/897284
Link: https://technet.microsoft.com/en-us/library/aa175396(v=SQL.80).aspx

Trace Flag: 831

Undocumented trace flag
Function: Protect unchanged pages in the buffer pool to catch memory corruptions
Link: None

Trace Flag: 833

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

Trace Flag: 834

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/kb/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

Trace Flag: 835

Undocumented trace flag
Function: SQL 9 / 10 – On 64 bit SQL Server it turns off Lock pages in memory
Link: None
Scope: ?

Trace Flag: 836

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

Trace Flag: 839

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

Trace Flag: 840

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

Trace Flag: 842

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

Trace Flag: 845

Undocumented trace flag
Function: Enable Lock pages in Memory on Standard Edition for SQL Server 2005 and 2008.
Link: https://support.microsoft.com/kb/970070
Link: https://support.microsoft.com/kb/2708594
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-845/
Scope: global only

Undocumented trace flag

Trace Flag: 851

Function: According to Bob Ward’s PASS 2014 talk on SQL Server IO, “disable[s] BPE even if enabled via ALTER SERVER”
Link: None

Trace Flag: 861

Undocumented trace flag
Function: According to the error log this disables buffer pool extension.
Link: New Undocumented Trace Flags
Scope: ?

Trace Flag: 862

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: ?

Trace Flag: 876

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: #151
Scope: global only

Undocumented trace flag

Trace Flag: 888

Function: Enables support for locked pages for SQL 2000
Link: None

Trace Flag: 902

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/kb/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

Trace Flag: 916

Undocumented trace flag
Function: The KB article references the flag in the context of seeing a Profiler dump
Link: None

Trace Flag: 1106

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/kb/947204
Link: https://blogs.msdn.microsoft.com/arvindsh/2014/02/24/tracking-tempdb-internal-object-space-usage-in-sql-2012

Trace Flag: 1117

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

Trace Flag: 1118

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/kb/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

Trace Flag: 1119

Function: Turns off mixed extent allocation (Similar to 1118?)
Link: TECHNET List Of SQL Server Trace Flags

Trace Flag: 1124

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

Trace Flag: 1140

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

Trace Flag: 1165

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: global or session Demo: https://github.com/ktaranov/sqlserver-kit/blob/master/Scripts/Trace_Flag/Trace_Flag_1165.sql

Trace Flag: 1180

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

Trace Flag: 1197

Undocumented trace flag
Function: Applies only in the case of SQL 7 – SP3, similar with trace flag 1180
Link: None

Trace Flag: 1200

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: ?

Trace Flag: 1202

Undocumented trace flag
Function: Insert blocked lock requests into syslocks
Link: None

Trace Flag: 1204

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/kb/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

Trace Flag: 1205

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/kb/832524

Trace Flag: 1206

Function: Used to complement flag 1204 by displaying other locks held by deadlock parties
Link: KB169960

Trace Flag: 1208

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

Trace Flag: 1211

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/kb/323630
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-1211/
Scope: global or session

Trace Flag: 1216

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

Trace Flag: 1217

Undocumented trace flag
Function: Disables (for 7.0) the “UMS Health” reporting messages described in the KB article.
Link: None

Trace Flag: 1222

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

Trace Flag: 1224

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:

  • Forty percent of the memory that is used by Database Engine. This is applicable only when the locks parameter of sp_configure is set to 0.
  • Forty percent of the lock memory that is configured by using the locks parameter of sp_configure. For more information, see Server Configuration Options (SQL Server). 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.
    Note: Lock escalation to the table- or HoBT-level granularity can also be controlled by using the LOCK_ESCALATION option of the ALTER TABLE statement.
    Link: Docs Trace Flags
    Link: Important Trace Flags That Every DBA Should Know
    Link: https://www.sqlservergeeks.com/sql-server-trace-flag-1224/
    Scope: global or session

Trace Flag: 1228

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

Trace Flag: 1229

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

Trace Flag: 1236

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/kb/2926217
Link: Docs Trace Flags
Link: KB2964518
Scope: global only

Trace Flag: 1237

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/kb/4025261
Link: Docs Trace Flags
Scope: global or session or query

Trace Flag: 1252

Undocumented trace flag
Function: It prints some kind of lock related information when 3604 is also enabled. Example:

SELECT * FROM master..spt_values
OPTION (QUERYTRACEON 1252, QUERYTRACEON 3604); 

Link: #196
Scope: ?

Trace Flag: 1260

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

Trace Flag: 1261

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

Trace Flag: 1262

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

Trace Flag: 1264

Function: Collect process names in non-yielding scenario memory dumps
Link: A Topical Collection of SQL Server Flags v6
Link: https://support.microsoft.com/kb/2630458

Trace Flag: 1400

Function: SQL 9 RTM – Enables creation of database mirroring endpoint, which is required for setting up and using database mirroring
Link: None

Trace Flag: 1439

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

Trace Flag: 1448

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

Trace Flag: 1449

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/kb/936179

Trace Flag: 1462

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

Trace Flag: 1482

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

Trace Flag: 1504

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

Trace Flag: 1603

Function: Use standard disk I/O (i.e. turn off asynchronous I/O)
Link: None

Trace Flag: 1604

Function: Once enabled at start up makes SQL Server output information regarding memory allocation requests
Link: None

Trace Flag: 1609

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

Trace Flag: 1610

Function: Boot the SQL dataserver with TCP_NODELAY enabled
Link: None

Trace Flag: 1611

Function: If possible, pin shared memory -- check errorlog for success/failure
Link: None

Trace Flag: 1613

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

Trace Flag: 1615

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

Trace Flag: 1704

Function: Prints information when a temporary table is created or dropped
Link: None

Trace Flag: 1717

Function: MSShipped bit will be set automatically at Create time when creating stored procedures
Link: None

Trace Flag: 1800

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/kb/3009974
Link: Docs Trace Flags
Scope: global only

Trace Flag: 1802

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/kb/922804

Trace Flag: 1806

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/kb/2574695
Link: Important Trace Flags That Every DBA Should Know
Scope: ?

Trace Flag: 1807

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/kb/304261

Trace Flag: 1808

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

Trace Flag: 1810

Function: Prints the file create/open/close timings
Link: None

Trace Flag: 1816

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

Trace Flag: 1819

Function: Allows backup to URL to leverage a proxy server when accessing Azure block blobs. In addition to this trace flag, you must set the WinHTTP proxy configuration on the server via one of the following methods:

  • The proxycfg.exe utility on Windows XP or Windows Server 2003 and earlier.
  • The netsh.exe utility on Windows Vista and Windows Server 2008 or later.
    Link: Docs Trace Flags Scope: global or session or query (QUERYTRACEON)

Trace Flag: 1851

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

Trace Flag: 1903

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

Trace Flag: 1905

Function: Unknown
Link: Upgrading an expired SQL Server 2016 Evaluation Edition

Trace Flag: 1906

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

Trace Flag: 2301

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

Trace Flag: 2309

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

Trace Flag: 2312

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

Trace Flag: 2315

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

Trace Flag: 2318

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

Trace Flag: 2324

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

Trace Flag: 2328

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

Trace Flag: 2329

Function: Disables “Few Outer Rows” optimization
Link: http://www.queryprocessor.com/few-outer-rows-optimization

Trace Flag: 2330

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/

Trace Flag: 2332

Function: PWhite: “Force DML Request Sort (CUpdUtil::FDemandRowsSortedForPerformance)”
Link: Optimizing T-SQL queries that change data

Trace Flag: 2335

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/kb/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

Trace Flag: 2336

Function: Aaron: Another one that I stumbled onto. Appears to tie memory info and cached page likelihoods with costing
Link: None

Trace Flag: 2340

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

Trace Flag: 2341

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/kb/3146123

Trace Flag: 2363

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

Trace Flag: 2368

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: ?

Trace Flag: 2371

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/kb/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 Demo: https://github.com/ktaranov/sqlserver-kit/blob/master/Scripts/Trace_Flag/Trace_Flag_2371.sql

Trace Flag: 2372

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

Trace Flag: 2373

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

Trace Flag: 2374

Undocumented trace flag
Function: Removes QueryHash and QueryPlanHash information from estimated query plans.
Link: New Undocumented Trace Flags
Scope: ?

Trace Flag: 2382

Function: SSC: “SQL 8 -Statistics collected for system tables.”
Link: None

Trace Flag: 2387

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: ?

Trace Flag: 2388

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

Trace Flag: 2389

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:
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: https://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/
Scope: global or session or query

Trace Flag: 2390

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
Use this flag only with 2389 trace flag.
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/
Scope: global or session or query

Trace Flag: 2392

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/kb/4042232
Scope: global only

Trace Flag: 2398

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

Trace Flag: 2399

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: ?

Trace Flag: 2418

Undocumented trace flag
Function: Disables serial Batch mode processing.
Link: New Undocumented Trace Flags
Scope: ?

Trace Flag: 2422

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/kb/4038419
Scope: global only

Trace Flag: 2430

Function: Fixes performance problem when using large numbers of locks
Link: https://support.microsoft.com/kb/2754301
Link: https://support.microsoft.com/kb/2746341

Trace Flag: 2440

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

Trace Flag: 2451

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

Trace Flag: 2453

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: https://sqlperformance.com/2014/06/t-sql-queries/table-variable-perf-fix
Link: https://support.microsoft.com/kb/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

Trace Flag: 2456

Function: Relieves RESOURCE_SEMAPHORE_MUTEX contention, which may be primarily due to a bug in SQL 2005.
Link: None

Trace Flag: 2466

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

Trace Flag: 2467

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

Trace Flag: 2468

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

Trace Flag: 2469

Function: Enables alternate exchange for INSERT INTO ... SELECT into a partitioned columnstore index.
Link: Docs Trace Flags
Link: https://support.microsoft.com/kb/3204769/
Scope: global or session or query

Trace Flag: 2470

Undocumented trace flag
Function: Fixes performance problem when using AFTER triggers on partitioned tables
Link: https://support.microsoft.com/kb/2606883

Trace Flag: 2479

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

Trace Flag: 2486

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

Undocumented trace flag

Trace Flag: 2505

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

Trace Flag: 2508

Undocumented trace flag
Function: Disables parallel non-clustered index checking for DBCC CHECKTABLE
Link: None

Trace Flag: 2509

Undocumented trace flag
Function: Used with DBCC CHECKTABLE to see the total count of forward records in a table
Link: None

Trace Flag: 2514

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

Trace Flag: 2520

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

Trace Flag: 2521

Undocumented trace flag
Function: SQL 7 SP2 - Facilitates capturing a Sqlservr.exe user-mode crash dump for postmortem analysis
Link: None

Trace Flag: 2528

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

Trace Flag: 2529

Undocumented trace flag
Function: Displays memory usage for DBCC commands when used with TF 3604
Link: None

Trace Flag: 2536

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

Trace Flag: 2537

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

Trace Flag: 2540

Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2541

Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2542

Undocumented trace flag
Function: SQL Server error log still tells you about the dump. But it never gets written. The error log still tells you about the stack text file, which still gets generated even with T2542 in place. Looks like that takes about 6 seconds rather than the dumps which were always over 1 minute. @sqL_handLe used it to resolve an issue where a production environment (with > 1 TB of RAM) was experiencing unhelpful memory dumps that would take more than 100 seconds to complete. 100 seconds is the max Availability Group lease timeout threshold.
Link: KB917825
Link: Controlling SQL Server memory dumps
Link: 197

Trace Flag: 2543

Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2544

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

Trace Flag: 2545

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2546

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

Trace Flag: 2547

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2548

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

Trace Flag: 2549

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: Minimizing the impact of DBCC CHECKDB 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: KB2634571
Link: https://support.microsoft.com/kb/2732669
Link: Docs Trace Flags
Link: KB2964518
Scope: global only

Trace Flag: 2550

Undocumented trace flag
Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2551

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

Trace Flag: 2552

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2553

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2554

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2555

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2556

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2557

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2558

Function: Disables integration between CHECKDB and Watson
Link: KB917825
Link: Controlling SQL Server memory dumps

Trace Flag: 2559

Function: Unknown, but related to controlling the contents of a memory dump
Link: KB917825

Trace Flag: 2562

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: Minimizing the impact of DBCC CHECKDB 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: KB2634571
Link: https://support.microsoft.com/kb/2732669
Link: Docs Trace Flags
Link: KB2964518
Scope: global only

Trace Flag: 2566

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: Minimizing the impact of DBCC CHECKDB
Link: https://support.microsoft.com/kb/2888996
Link: KB2964518
Scope: global only

Trace Flag: 2588

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

Trace Flag: 2592

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

Trace Flag: 2701

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

Trace Flag: 2861

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/
Link: https://web.archive.org/web/20121008074923/http://support.microsoft.com/kb/325607
Scope: global only

Trace Flag: 2880

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

Trace Flag: 2881

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

Trace Flag: 3001

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

Trace Flag: 3004

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

Trace Flag: 3014

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

Trace Flag: 3023

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/kb/2656988
Link: Docs Trace Flags
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3023/
Scope: global or session

Trace Flag: 3028

Function: Enables a hotfix for a problem encountered when backing up to tape with specific backup options
Link: None

Trace Flag: 3031

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

Trace Flag: 3034

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

Trace Flag: 3035

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

Trace Flag: 3039

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

Trace Flag: 3042

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/kb/2001026
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

Trace Flag: 3051

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

Trace Flag: 3057

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/kb/2987585

Trace Flag: 3101

Function: Fix performance problems when restoring database with CDC
Link: https://support.microsoft.com/kb/2567366

Trace Flag: 3104

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

Trace Flag: 3106

Function: Required to move sys databases
Link: None

Trace Flag: 3111

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

Trace Flag: 3117

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

Trace Flag: 3205

Function: Disable HW compression for backup to tape drives
Link: Docs Trace Flags
Scope: global only

Trace Flag: 3207

Function: Fixes SQL 6.5 so that tape drives work correctly with DUMP and LOAD statements
Link: None

Trace Flag: 3210

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

Trace Flag: 3212

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

Trace Flag: 3213

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

Trace Flag: 3216

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

Trace Flag: 3222

Function: Disables the read ahead that is used by the recovery operation during roll forward operations
Link: TECHNET List Of SQL Server Trace Flags

Trace Flag: 3226

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

Trace Flag: 3231

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: ?

Trace Flag: 3282

Undocumented trace flag
Function: SQL 6.5 - Used after backup restoration fails
Scope: ?

Trace Flag: 3400

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

Trace Flag: 3408

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/

Trace Flag: 3412

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

Trace Flag: 3422

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/kb/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: ?

Trace Flag: 3427

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/kb/3216543
Link: TEMPDB – Files and Trace Flags and Updates
Scope: global only

Trace Flag: 3448

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/kb/2970421

Trace Flag: 3449

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/kb/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

Trace Flag: 3459

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/kb/3200975
Link: https://support.microsoft.com/kb/4101554
Link: https://support.microsoft.com/kb/4339858
Scope: global only

Trace Flag: 3468

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

Trace Flag: 3499

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

Trace Flag: 3502

Undocumented trace flag
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: A SQL Server DBA myth a day: (15/30) checkpoint only writes pages from committed transactions
Link: https://www.sqlservergeeks.com/sql-server-trace-flag-3502/
Scope: session only

Trace Flag: 3503

Undocumented trace flag
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/

Trace Flag: 3504

Undocumented trace flag
Function: writes to the error log information about what is written to disk. 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: A SQL Server DBA myth a day: (15/30) 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/
Link: https://docs.microsoft.com/en-us/archive/blogs/psssql/how-it-works-when-is-the-flushcache-message-added-to-sql-server-error-log
Scope: session only

Trace Flag: 3505

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

Trace Flag: 3601

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

Trace Flag: 3602

Function: Records all error and warning messages sent to the client
Link: https://support.microsoft.com/kb/199037

Trace Flag: 3603

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

Trace Flag: 3604

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

Trace Flag: 3605

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

Trace Flag: 3607

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/

Trace Flag: 3608

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

Trace Flag: 3609

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

Trace Flag: 3610

Function: SQL 9 - Divide by zero to result in NULL instead of error
Link: None

Trace Flag: 3614

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

Trace Flag: 3618

Undocumented trace flag
Function: Disable the new Metadata-Only Column Changes in SQL Server 2016 and upper versions. This trace flag is not effective when used at the session level. There is no way to specify a query-level trace flag with an ALTER COLUMN command.
Link: https://sqlperformance.com/2020/04/database-design/new-metadata-column-changes-sql-server-2016
Scope: globa only

Trace Flag: 3625

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

Trace Flag: 3626

Function: Turns on tracking of the CPU data for the sysprocesses table.
Link: None

Trace Flag: 3628

Function: CSS’s mysterious description: “Includes ‘other errors’ in the dump based on a severity.”
Link: Controlling SQL Server memory dumps

Trace Flag: 3629

Function: CSS: A memory dump will “include messages marked to include with this trace flag enabled.”
Link: Controlling SQL Server memory dumps

Trace Flag: 3635

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

Trace Flag: 3640

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

Trace Flag: 3651

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: ?

Trace Flag: 3654

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/kb/2888658

Trace Flag: 3656

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

Trace Flag: 3659

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

Trace Flag: 3660

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

Trace Flag: 3663

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

Trace Flag: 3688

Function: Removes messages to error log about traces started and stopped
Link: https://support.microsoft.com/kb/922578

Trace Flag: 3689

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/kb/922578

Trace Flag: 3701

Function: Unknown
Link: Upgrading an expired SQL Server 2016 Evaluation Edition

Trace Flag: 3801

Function: Prohibits use of USE DB statement
Link: None

Trace Flag: 3861

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/kb/3003760

Trace Flag: 3895

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

Trace Flag: 3913

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

Trace Flag: 3917

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

Trace Flag: 3923

Function: Let SQL Server throw an exception to the application when the 3303 warning message is raised
Link: https://support.microsoft.com/kb/3014867

Trace Flag: 3924

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/kb/4519668
Link: https://support.microsoft.com/kb/4511816
Scope: global only

Trace Flag: 3940

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

Trace Flag: 3979

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

Trace Flag: 3982

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

Trace Flag: 4001

Function: Very verbose logging of each login attempt to the error log. Includes tons of information
Link: None

Trace Flag: 4010

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

Trace Flag: 4013

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

Trace Flag: 4020

Function: Boot without recover
Link: None

Trace Flag: 4022

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

Trace Flag: 4029

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

Trace Flag: 4030

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

Trace Flag: 4031

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

Trace Flag: 4032

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/kb/199037
Link: http://www.sqlservergeeks.com/sql-server-trace-flag-4032/
Scope: global only

Trace Flag: 4044

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

Trace Flag: 4052

Function: SQL 9+ Prints TDS packets sent to the client (output) to console. Startup only.
Link: None

Trace Flag: 4055

Function: SQL 9+ Prints TDS packets received from the client to console. Startup only.
Link: None

Trace Flag: 4101

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/kb/318530

Trace Flag: 4102

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/kb/946020

Trace Flag: 4103

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

Trace Flag: 4104

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

Trace Flag: 4105

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

Trace Flag: 4106

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

Trace Flag: 4107

Function: SQL 9 - When you run a query that references a partitioned table, query performance may decrease
Link: None

Trace Flag: 4108

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

Trace Flag: 4109

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/kb/926773

Trace Flag: 4110

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

Trace Flag: 4111

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

Trace Flag: 4112

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/kb/936223

Trace Flag: 4115

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

Trace Flag: 4116

Function: SQL 9 - Query runs slowly when using joins between a local and a remote table
Link: None

Trace Flag: 4117

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

Trace Flag: 4119

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

Trace Flag: 4120

Function: “FIX: Error message when you perform an update operation by using a cursor in SQL Server 2005: Transaction (Process ID ) was deadlocked on lock resources with another process and has been chosen as the deadlock victim” This issue is apparently due to deadlock issues related to upgrading a U lock to an X lock.
Link: https://support.microsoft.com/kb/953948

Trace Flag: 4121

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

Trace Flag: 4123

Function: Query that has many outer joins takes a long time to compile in SQL Server 2005
Link: None

Trace Flag: 4124

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

Trace Flag: 4125

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

Trace Flag: 4126

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/kb/959013

Trace Flag: 4127

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

Trace Flag: 4128

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/kb/957872

Trace Flag: 4129

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

Trace Flag: 4130

Function: XML performance fix
Link: None

Trace Flag: 4131

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

Trace Flag: 4133

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/kb/958006

Trace Flag: 4134

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/kb/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

Trace Flag: 4135

Function: Bugfix for error inserting to temp table
Link: https://support.microsoft.com/kb/960770
Link: https://connect.microsoft.com/SQLServer/feedback/details/541352/tempdb-errors-during-statistics-auto-update

Trace Flag: 4136

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: