Skip to content

Commit 5b95670

Browse files
committed
#3631 sp_BlitzFirst add thread time
To headline news result set. Closes #3631.
1 parent 4493dde commit 5b95670

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

Documentation/sp_BlitzFirst_Checks_by_Priority.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav
66

77
If you want to change anything about a check - the priority, finding, URL, or ID - open a Github issue first. The relevant scripts have to be updated too.
88

9-
CURRENT HIGH CHECKID: 49
10-
If you want to add a new check, start at 50.
9+
CURRENT HIGH CHECKID: 50
10+
If you want to add a new check, start at 51.
1111

1212
| Priority | FindingsGroup | Finding | URL | CheckID |
1313
|----------|---------------------------------|---------------------------------------|-------------------------------------------------|----------|
@@ -58,4 +58,5 @@ If you want to add a new check, start at 50.
5858
| 251 | Server Info | Database Count | | 22 |
5959
| 251 | Server Info | Database Size, Total GB | | 21 |
6060
| 251 | Server Info | Memory Grant/Workspace info | | 40 |
61+
| 251 | Server Info | Thread Time | https://www.brentozar.com/go/threadtime | 50 |
6162
| 254 | Informational | Thread Time Inaccurate | | 48 |

sp_BlitzFirst.sql

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit,
20212021
FROM sys.databases
20222022
WHERE database_id > 4;
20232023

2024+
20242025
/* Server Info - Memory Grants pending - CheckID 39 */
20252026
IF (@Debug = 1)
20262027
BEGIN
@@ -3325,6 +3326,34 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit,
33253326
OR max_session_percent >= 90);
33263327
END
33273328

3329+
/* Server Info - Thread Time - CheckID 50 */
3330+
IF (@Debug = 1)
3331+
BEGIN
3332+
RAISERROR('Running CheckID 50',10,1) WITH NOWAIT;
3333+
END
3334+
3335+
;WITH max_batch AS (
3336+
SELECT MAX(SampleTime) AS SampleTime
3337+
FROM #WaitStats
3338+
)
3339+
INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, DetailsInt, URL)
3340+
SELECT TOP 1 50 AS CheckID,
3341+
251 AS Priority,
3342+
'Server Info' AS FindingGroup,
3343+
'Thread Time' AS Finding,
3344+
CAST(CAST(c.[Total Thread Time (Seconds)] AS DECIMAL(18,1)) AS VARCHAR(100)) AS Details,
3345+
CAST(c.[Total Thread Time (Seconds)] AS DECIMAL(18,1)) AS DetailsInt,
3346+
'https://www.brentozar.com/go/threadtime' AS URL
3347+
FROM max_batch b
3348+
JOIN #WaitStats wd2 ON
3349+
wd2.SampleTime =b.SampleTime
3350+
JOIN #WaitStats wd1 ON
3351+
wd1.wait_type=wd2.wait_type AND
3352+
wd2.SampleTime > wd1.SampleTime
3353+
CROSS APPLY (SELECT
3354+
CAST((wd2.thread_time_ms - wd1.thread_time_ms)/1000. AS DECIMAL(18,1)) AS [Total Thread Time (Seconds)]
3355+
) AS c;
3356+
33283357
/* Server Info - Batch Requests per Sec - CheckID 19 */
33293358
IF (@Debug = 1)
33303359
BEGIN

0 commit comments

Comments
 (0)