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.
Clear-DbaWaitStatistics View Source Chrissy LeMaire (@cl) Windows, Linux, macOS Synopsis Resets SQL Server wait statistics to establish a clean monitoring baseline
Description Clears all accumulated wait statistics from sys.dm_os_wait_stats by executing DBCC SQLPERF (N’sys.dm_os_wait_stats’, CLEAR). This is essential for performance troubleshooting when you need to establish a new baseline for wait analysis. DBAs commonly clear wait stats after resolving performance issues, during maintenance windows, or when beginning focused monitoring periods to isolate specific workload patterns without historical noise.
Get-DbaLatchStatistic View Source Patrick Flynn (@sqllensman) Windows, Linux, macOS Synopsis Retrieves latch contention statistics from SQL Server to identify performance bottlenecks
Description Analyzes latch wait statistics from sys.dm_os_latch_stats to help identify latch contention issues that may be causing performance problems. This function implements Paul Randal’s methodology for latch troubleshooting by returning the most significant latch classes based on cumulative wait time percentage. Each result includes direct links to SQLSkills documentation explaining what each latch class means and how to resolve related issues, making it easier to diagnose and fix latch-related performance bottlenecks without manually querying system DMVs.
Get-DbaSpinLockStatistic View Source Patrick Flynn (@sqllensman) Windows, Linux, macOS Synopsis Retrieves spinlock contention statistics from SQL Server’s internal synchronization mechanisms
Description Queries sys.dm_os_spinlock_stats to return detailed statistics about SQL Server’s spinlock usage and contention. Spinlocks are lightweight synchronization primitives that SQL Server uses internally for very brief waits when protecting critical code sections and memory structures.
This information helps diagnose severe performance issues caused by spinlock contention, which typically manifests as high CPU usage with poor throughput.
Get-DbaWaitingTask View Source Shawn Melton (@wsmelton), wsmelton.github.io Windows, Linux, macOS Synopsis Retrieves detailed information about currently waiting sessions and their wait types from SQL Server dynamic management views.
Description Queries sys.dm_os_waiting_tasks and related DMVs to identify sessions that are currently waiting, along with comprehensive diagnostic information including wait types, durations, blocking sessions, SQL text, and query plans. This function helps DBAs quickly identify performance bottlenecks, troubleshoot blocking issues, and analyze what’s causing slowdowns in real-time.
Get-DbaWaitStatistic View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Retrieves SQL Server wait statistics for performance analysis and troubleshooting
Description Analyzes SQL Server wait statistics from sys.dm_os_wait_stats to identify performance bottlenecks and resource contention issues. This function categorizes wait types, calculates timing metrics and percentages, and provides diagnostic explanations based on Paul Randal’s methodology. Use this to pinpoint whether your SQL Server is waiting on disk I/O, memory pressure, locking issues, or other resource constraints that are slowing down query performance.