You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sp_BlitzFirst: add Top 5 server/login/app breakdown to High Number of Connections (BrentOzarULTD#3903)
When CheckID 49 fires, the Details column now includes three ranked sections
(Top 5 Servers, Top 5 Logins, Top 5 Apps) showing connection counts plus the
most-recent and oldest query finish ages for each. Operators can quickly spot
whether connection pressure is concentrated in one app server or login vs.
spread across the fleet.
Implementation notes:
* Loads sys.dm_exec_connections joined to sys.dm_exec_sessions into a table
variable once, then aggregates it three ways so the DMVs are only read once.
* Treats sys.dm_exec_sessions.last_request_end_time = 1900-01-01 (the sentinel
for sessions that have never run a request) as NULL so it renders as
"unknown" rather than "45000 days ago".
* Pre-computes the total connection count into a variable and gates the
breakdown work behind an explicit IF so we only do the extra aggregation
when the alert actually fires.
* Bumps sp_BlitzFirst version to 8.33 / 20260415.
ClosesBrentOzarULTD#3903.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
'There are '+CAST(SUM(1) ASVARCHAR(20)) +' open connections, which would lead to '+ @LineFeed +'worker thread exhaustion and THREADPOOL waits'+ @LineFeed +'if they all ran queries at the same time.'AS Details
2674
-
FROMsys.dm_exec_connections c
2675
-
HAVINGSUM(1) > @max_worker_threads;
2667
+
/* Count connections first so we only build the Top 5 breakdowns when the
2668
+
alert actually fires. See issue #3903 for the feature request. */
2669
+
DECLARE @TotalConnections INT;
2670
+
SET @TotalConnections = (SELECTCOUNT(*) FROMsys.dm_exec_connections);
2671
+
2672
+
IF @TotalConnections > @max_worker_threads
2673
+
BEGIN
2674
+
/* Load connection + session attributes into a table variable once so we can
2675
+
aggregate it three different ways (by host, login, and app) without
2676
+
re-reading the DMVs. sys.dm_exec_sessions.last_request_end_time defaults
2677
+
to 1900-01-01 for sessions that have never run a request - treat that
2678
+
sentinel as NULL so it renders as "unknown" rather than "45000 days ago". */
0 commit comments