Is Trace Flag 8001 still relevant

After reading an old article about the SQL Server DMV sys.dm_os_wait_stats running on SQL Server 2005.  I learned about the undocumented trace flag 8001, which enables all the wait types to displayed when DMV sys.dm_os_wait_stats is run.  Microsoft determined that is was not necessary that we see all the wait types when using this DMV.  Most of the wait types hidden from us were related to things like the startup & shutdown of SQL Server.

When tested on a SQL Server 2005 instance, we see 49 more wait types are available when the trace flag is enabled.

When first tested this trace flag in SQL Server 2016, I found no difference in the count of wait types for the DMV sys.dm_os_wait_stats when the trace flag was enabled.

A little more digging, and found that this trace flag was only usable for SQL Server 2005.  Starting with SQL Server 2008 (before R2), Microsoft made all wait types available for the DMV sys.dm_os_wait_stats.

Below is the queries I ran to get the results above:

SET NOCOUNT ON;

select @@version;
go

select count(*) as 'count from sys.dm_os_wait_stats without trace flag 8001 enabled' 
from sys.dm_os_wait_stats;
go

dbcc traceon (8001, -1);
go

dbcc tracestatus;
go

select count(*) as 'count from sys.dm_os_wait_stats with trace flag 8001 enabled' 
from sys.dm_os_wait_stats;
go

Leave a Reply