Clearing Wait Stats on the server.

Understanding wait stats and interpreting them correctly helps greatly in tuning the queries for better performance. Every now and then, we would want to clear the stats on the test server, so, we can check whether the new improvements have positive impact before rolling them into production. Sometimes,We would want to save this information into a table for comparison.

Obviously, one way to do this is by restarting the SQL Service.As these values are not stored physically,they will be cleared out. The problem here is,it is not always feasible to restart the server.

The other option,probably better one,is DBCC SQLPERF(‘sys.dm_os_Wait_Tasks’,CLEAR)
This command will reset the wait stats.
We can also clear latch stats using DBCC SQLPERF(‘sys.dm_os_latch_Tasks’,CLEAR)