sys.dm_exec_session_wait_stats (Transact-sql) sys.dm_exec_session_wait_stats (Transact-SQL)
适用于:Applies to: SQL Server 2016 (13.x)SQL Server 2016 (13.x)
SQL Server 2016 (13.x)SQL Server 2016 (13.x)
Azure SQL 数据库Azure SQL Database
Azure SQL 数据库Azure SQL Database
Azure SQL 托管实例Azure SQL Managed Instance
Azure SQL 托管实例Azure SQL Managed Instance
SQL Server 2016 (13.x)SQL Server 2016 (13.x)
SQL Server 2016 (13.x)SQL Server 2016 (13.x)
Azure SQL 数据库Azure SQL Database
Azure SQL 数据库Azure SQL Database
Azure SQL 托管实例Azure SQL Managed Instance
Azure SQL 托管实例Azure SQL Managed Instance
返回有关对每个会话执行的线程所遇到的所有等待的信息。Returns information about all the waits encountered by threads that executed for each session. 您可以使用此视图诊断会话的性能问题 SQL ServerSQL Server 以及特定查询和批处理。You can use this view to diagnose performance issues with the SQL ServerSQL Server session and also with specific queries and batches. 此视图返回的会话与 sys.dm_os_wait_stats (transact-sql) 聚合的信息相同,但也提供 session_id 号。This view returns session the same information that is aggregated for sys.dm_os_wait_stats (Transact-SQL) but provides the session_id number as well.
适用于:SQL ServerSQL Server(SQL Server 2016 (13.x)SQL Server 2016 (13.x) 及更高版本)。Applies to: SQL ServerSQL Server ( SQL Server 2016 (13.x)SQL Server 2016 (13.x) and later).
列名称Column name | 数据类型Data type | 说明Description |
---|---|---|
session_idsession_id | smallintsmallint | 会话的 id。The id of the session. |
wait_typewait_type | nvarchar(60)nvarchar(60) | 等待类型的名称。Name of the wait type. 有关详细信息,请参阅 sys.dm_os_wait_stats (Transact-SQL)。For more information, see sys.dm_os_wait_stats (Transact-SQL). |
waiting_tasks_countwaiting_tasks_count | bigintbigint | 该等待类型的等待数。Number of waits on this wait type. 该计数器在每开始一个等待时便会增加。This counter is incremented at the start of each wait. |
wait_time_mswait_time_ms | bigintbigint | 该等待类型的总等待时间(毫秒)。Total wait time for this wait type in milliseconds. 该时间包括 signal_wait_time_ms。This time is inclusive of signal_wait_time_ms. |
max_wait_time_msmax_wait_time_ms | bigintbigint | 该等待类型的最长等待时间。Maximum wait time on this wait type. |
signal_wait_time_mssignal_wait_time_ms | bigintbigint | 正在等待的线程从收到信号通知到其开始运行之间的时差。Difference between the time that the waiting thread was signaled and when it started running. |
备注Remarks
当会话打开时,此 DMV 会重置会话的信息,如果连接池) ,则重置会话 (This DMV resets the information for a session when the session is opened, or when the session is reset (if connection pooling),
有关等待类型的信息,请参阅 (transact-sql)sys.dm_os_wait_stats 。For information about the wait types, see sys.dm_os_wait_stats (Transact-SQL).
权限Permissions
如果用户对服务器具有 VIEW SERVER STATE 权限,则用户将看到该实例上的所有正在执行的会话 SQL ServerSQL Server ; 否则,用户将只看到当前会话。If the user has VIEW SERVER STATE permission on the server, the user will see all executing sessions on the instance of SQL ServerSQL Server; otherwise, the user will see only the current session.
另请参阅See Also
动态管理视图和函数 (Transact-SQL) Dynamic Management Views and Functions (Transact-SQL)
(Transact-sql 的与操作系统相关的动态管理视图 SQL Server) SQL Server Operating System Related Dynamic Management Views (Transact-SQL)
sys.dm_os_wait_stats (Transact-SQL)sys.dm_os_wait_stats (Transact-SQL)