dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Get-DbaWaitStatistic

This command is based off of Paul Randal’s post “Wait statistics, or please tell me where it hurts”.

Returns:
– WaitType
– Category
– WaitSeconds
– ResourceSeconds
– SignalSeconds
– WaitCount
– Percentage
– AverageWaitSeconds
– AverageResourceSeconds
– AverageSignalSeconds
– URL

Reference: SQL Skills

Screenshots

dbatools-Get-DbaWaitStatistic

Examples

Check wait statistics for servers sql2008 and sqlserver2012.

Get-DbaWaitStatistic -SqlInstance sql2008, sqlserver2012

Check wait statistics on server sql2008 for thresholds above 98% and include wait stats that are most often, but not always, ignorable.

Get-DbaWaitStatistic -SqlInstance sql2008 -Threshold 98 -IncludeIgnorable

Shows detailed notes, if available, from Paul’s post.

Get-DbaWaitStatistic -SqlInstance sql2008 | Select *

Displays the output then loads the associated sqlskills website for each result. Opens one tab per unique URL.

$output = Get-DbaWaitStatistic -SqlInstance sql2008
$output
foreach ($row in ($output | Sort-Object -Unique Url)) { Start-Process ($row).Url }

Author

This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.

Get-Help

From PowerShell, execute Get-Help Get-DbaWaitStatistic -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaWaitStatistic.ps1 on GitHub
 

Related commands