title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | f1_keywords | helpviewer_keywords | dev_langs | monikerRange | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sys.dm_exec_session_wait_stats (Transact-SQL) |
sys.dm_exec_session_wait_stats returns information about all the waits encountered by threads that executed for each session. |
rwestMSFT |
randolphwest |
07/08/2024 |
sql |
system-objects |
reference |
|
|
|
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current |
[!INCLUDE sqlserver2016-asdb-asdbmi]
Returns information about all the waits encountered by threads that executed for each session. You can use this view to diagnose performance issues with the [!INCLUDE ssNoVersion] session and also with specific queries and batches. This view returns the same information that is aggregated for sys.dm_os_wait_stats, and provides the session_id
number as well.
Column name | Data type | Description |
---|---|---|
session_id |
smallint | The ID of the session. |
wait_type |
nvarchar(60) | Name of the wait type. For more information, see sys.dm_os_wait_stats. |
waiting_tasks_count |
bigint | Number of waits on this wait type. This counter is incremented at the start of each wait. |
wait_time_ms |
bigint | Total wait time for this wait type in milliseconds. This time is inclusive of signal_wait_time_ms . |
max_wait_time_ms |
bigint | Maximum wait time on this wait type. |
signal_wait_time_ms |
bigint | Difference between the time that the waiting thread was signaled and when it started running. |
This DMV resets the information for a session when the session is opened, or when the session is reset (if connection pooling),
For information about the wait types, see sys.dm_os_wait_stats.
For [!INCLUDE sssql19-md] and previous versions, if you have VIEW SERVER STATE
permission on the server, you see all executing sessions on the instance of [!INCLUDE ssNoVersion]; otherwise, you see only the current session.
For [!INCLUDE sssql22-md] and later versions, you require VIEW SERVER PERFORMANCE STATE
permission on the server.