Thor Logo dbatools

LatchStatistic

Clear-DbaLatchStatistics

Patrick Flynn (@sqllensman)

Clear-DbaLatchStatistics View Source Patrick Flynn (@sqllensman) Windows, Linux, macOS Synopsis Resets SQL Server latch statistics counters to establish a fresh performance baseline Description Clears all accumulated latch statistics from the sys.dm_os_latch_stats dynamic management view by executing DBCC SQLPERF (N’sys.dm_os_latch_stats’, CLEAR). This resets counters for latch types like BUFFER, ACCESS_METHODS_DATASET_PARENT, and others to zero values. Use this when troubleshooting latch contention to get a clean baseline before running your workload, or during performance testing to measure the impact of specific queries or operations.

Read more