Skip to content

Commit dcfc4ec

Browse files
committed
#3629 sp_BlitzFirst move avg ms
To the left in result sets. Closes #3629.
1 parent ff080d3 commit dcfc4ec

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

sp_BlitzFirst.sql

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4654,13 +4654,13 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit,
46544654
wd1.wait_type,
46554655
COALESCE(wcat.WaitCategory, 'Other') AS wait_category,
46564656
CAST(c.[Wait Time (Seconds)] / 60. / 60. AS DECIMAL(18,1)) AS [Wait Time (Hours)],
4657-
CAST((wd2.wait_time_ms - wd1.wait_time_ms) / 1000.0 / cores.cpu_count / DATEDIFF(ss, wd1.SampleTime, wd2.SampleTime) AS DECIMAL(18,1)) AS [Per Core Per Hour],
4658-
(wd2.waiting_tasks_count - wd1.waiting_tasks_count) AS [Number of Waits],
46594657
CASE WHEN (wd2.waiting_tasks_count - wd1.waiting_tasks_count) > 0
46604658
THEN
46614659
CAST((wd2.wait_time_ms-wd1.wait_time_ms)/
46624660
(1.0*(wd2.waiting_tasks_count - wd1.waiting_tasks_count)) AS NUMERIC(12,1))
4663-
ELSE 0 END AS [Avg ms Per Wait]
4661+
ELSE 0 END AS [Avg ms Per Wait],
4662+
CAST((wd2.wait_time_ms - wd1.wait_time_ms) / 1000.0 / cores.cpu_count / DATEDIFF(ss, wd1.SampleTime, wd2.SampleTime) AS DECIMAL(18,1)) AS [Per Core Per Hour],
4663+
(wd2.waiting_tasks_count - wd1.waiting_tasks_count) AS [Number of Waits]
46644664
FROM max_batch b
46654665
JOIN #WaitStats wd2 ON
46664666
wd2.SampleTime =b.SampleTime
@@ -4799,17 +4799,17 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit,
47994799
wd1.wait_type,
48004800
COALESCE(wcat.WaitCategory, 'Other') AS wait_category,
48014801
CAST(c.[Wait Time (Seconds)] / 60. / 60. AS DECIMAL(18,1)) AS [Wait Time (Hours)],
4802+
CASE WHEN (wd2.waiting_tasks_count - wd1.waiting_tasks_count) > 0
4803+
THEN
4804+
CAST((wd2.wait_time_ms-wd1.wait_time_ms)/
4805+
(1.0*(wd2.waiting_tasks_count - wd1.waiting_tasks_count)) AS NUMERIC(12,1))
4806+
ELSE 0 END AS [Avg ms Per Wait],
48024807
CAST((wd2.wait_time_ms - wd1.wait_time_ms) / 1000.0 / cores.cpu_count / DATEDIFF(ss, wd1.SampleTime, wd2.SampleTime) AS DECIMAL(18,1)) AS [Per Core Per Hour],
48034808
CAST(c.[Signal Wait Time (Seconds)] / 60.0 / 60 AS DECIMAL(18,1)) AS [Signal Wait Time (Hours)],
48044809
CASE WHEN c.[Wait Time (Seconds)] > 0
48054810
THEN CAST(100.*(c.[Signal Wait Time (Seconds)]/c.[Wait Time (Seconds)]) AS NUMERIC(4,1))
48064811
ELSE 0 END AS [Percent Signal Waits],
48074812
(wd2.waiting_tasks_count - wd1.waiting_tasks_count) AS [Number of Waits],
4808-
CASE WHEN (wd2.waiting_tasks_count - wd1.waiting_tasks_count) > 0
4809-
THEN
4810-
CAST((wd2.wait_time_ms-wd1.wait_time_ms)/
4811-
(1.0*(wd2.waiting_tasks_count - wd1.waiting_tasks_count)) AS NUMERIC(12,1))
4812-
ELSE 0 END AS [Avg ms Per Wait],
48134813
N'https://www.sqlskills.com/help/waits/' + LOWER(wd1.wait_type) + '/' AS URL
48144814
FROM max_batch b
48154815
JOIN #WaitStats wd2 ON
@@ -4843,17 +4843,17 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit,
48434843
wd1.wait_type,
48444844
COALESCE(wcat.WaitCategory, 'Other') AS wait_category,
48454845
c.[Wait Time (Seconds)],
4846+
CASE WHEN (wd2.waiting_tasks_count - wd1.waiting_tasks_count) > 0
4847+
THEN
4848+
CAST((wd2.wait_time_ms-wd1.wait_time_ms)/
4849+
(1.0*(wd2.waiting_tasks_count - wd1.waiting_tasks_count)) AS NUMERIC(12,1))
4850+
ELSE 0 END AS [Avg ms Per Wait],
48464851
CAST((CAST(wd2.wait_time_ms - wd1.wait_time_ms AS MONEY)) / 1000.0 / cores.cpu_count / DATEDIFF(ss, wd1.SampleTime, wd2.SampleTime) AS DECIMAL(18,1)) AS [Per Core Per Second],
48474852
c.[Signal Wait Time (Seconds)],
48484853
CASE WHEN c.[Wait Time (Seconds)] > 0
48494854
THEN CAST(100.*(c.[Signal Wait Time (Seconds)]/c.[Wait Time (Seconds)]) AS NUMERIC(4,1))
48504855
ELSE 0 END AS [Percent Signal Waits],
48514856
(wd2.waiting_tasks_count - wd1.waiting_tasks_count) AS [Number of Waits],
4852-
CASE WHEN (wd2.waiting_tasks_count - wd1.waiting_tasks_count) > 0
4853-
THEN
4854-
CAST((wd2.wait_time_ms-wd1.wait_time_ms)/
4855-
(1.0*(wd2.waiting_tasks_count - wd1.waiting_tasks_count)) AS NUMERIC(12,1))
4856-
ELSE 0 END AS [Avg ms Per Wait],
48574857
N'https://www.sqlskills.com/help/waits/' + LOWER(wd1.wait_type) + '/' AS URL
48584858
FROM max_batch b
48594859
JOIN #WaitStats wd2 ON

0 commit comments

Comments
 (0)