< Back
Get-DbaWaitStatistic
Post
NAME Get-DbaWaitStatistic
SYNOPSIS
Displays wait statistics
SYNTAX
Get-DbaWaitStatistic [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]
<Pscredential>] [[-Threshold] <Int>] [-IncludeIgnorable <Switch>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
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: https://www.sqlskills.com/blogs/paul/wa ... -it-hurts/
PARAMETERS
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-IncludeIgnorable [<Switch>]
Some waits are no big deal and can be safely ignored in most circumstances. If you've got weird issues with
mirroring or AGs.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory -
Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances. Server version must be SQL Server version 2005 or higher.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Threshold [<Int>]
Threshold, in percentage of all waits on the system. Default per Paul's post is 95%.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: WaitStatistic
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-DbaWaitStatistic -SqlInstance sql2008, sqlserver2012
Check wait statistics for servers sql2008 and sqlserver2012
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-DbaWaitStatistic -SqlInstance sql2008 -Threshold 98 -IncludeIgnorable
Check wait statistics on server sql2008 for thresholds above 98% and include wait stats that are most often, but
not always, ignorable
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-DbaWaitStatistic -SqlInstance sql2008 | Select-Object *
Shows detailed notes, if available, from Paul's post
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>$output = Get-DbaWaitStatistic -SqlInstance sql2008 -Threshold 100 -IncludeIgnorable | Select-Object * |
ConvertTo-DbaDataTable
Collects all Wait Statistics (including ignorable waits) on server sql2008 into a Data Table.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>$output = Get-DbaWaitStatistic -SqlInstance sql2008
PS C:\\> foreach ($row in ($output | Sort-Object -Unique Url)) { Start-Process ($row).Url }
Displays the output then loads the associated sqlskills website for each result. Opens one tab per unique URL.
RELATED LINKS
https://dbatools.io/Get-DbaWaitStatistic
SYNOPSIS
Displays wait statistics
SYNTAX
Get-DbaWaitStatistic [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]
<Pscredential>] [[-Threshold] <Int>] [-IncludeIgnorable <Switch>] [-EnableException <Switch>] [<CommonParameters>]
DESCRIPTION
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: https://www.sqlskills.com/blogs/paul/wa ... -it-hurts/
PARAMETERS
-EnableException [<Switch>]
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables
advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own
try/catch.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-IncludeIgnorable [<Switch>]
Some waits are no big deal and can be safely ignored in most circumstances. If you've got weird issues with
mirroring or AGs.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlCredential [<Pscredential>]
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory -
Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]
The target SQL Server instance or instances. Server version must be SQL Server version 2005 or higher.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Threshold [<Int>]
Threshold, in percentage of all waits on the system. Default per Paul's post is 95%.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: WaitStatistic
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-DbaWaitStatistic -SqlInstance sql2008, sqlserver2012
Check wait statistics for servers sql2008 and sqlserver2012
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-DbaWaitStatistic -SqlInstance sql2008 -Threshold 98 -IncludeIgnorable
Check wait statistics on server sql2008 for thresholds above 98% and include wait stats that are most often, but
not always, ignorable
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-DbaWaitStatistic -SqlInstance sql2008 | Select-Object *
Shows detailed notes, if available, from Paul's post
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>$output = Get-DbaWaitStatistic -SqlInstance sql2008 -Threshold 100 -IncludeIgnorable | Select-Object * |
ConvertTo-DbaDataTable
Collects all Wait Statistics (including ignorable waits) on server sql2008 into a Data Table.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>$output = Get-DbaWaitStatistic -SqlInstance sql2008
PS C:\\> foreach ($row in ($output | Sort-Object -Unique Url)) { Start-Process ($row).Url }
Displays the output then loads the associated sqlskills website for each result. Opens one tab per unique URL.
RELATED LINKS
https://dbatools.io/Get-DbaWaitStatistic