Skip to content

PopSQL: limited support.

Migrate now →

Sessions by status

User sessions grouped by status (running, sleeping, dormant), from sys.dm_exec_sessions. Many sleeping sessions usually mean an oversized connection pool.

SQL Server · SQL
SELECT status,
       COUNT(*) AS sessions
FROM sys.dm_exec_sessions
WHERE is_user_process = 1
GROUP BY status
ORDER BY sessions DESC

This query is part of the "SQL Server health" pack: connect the database in DataRunner and install the whole pack — queries, dashboard and checks — at once.