Skip to content

Commit 23e70d0

Browse files
authored
Merge pull request #3546 from erikdarlingdata/dev
Closes #3545
2 parents bcfea44 + a3a444e commit 23e70d0

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

sp_BlitzLock.sql

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ ALTER PROCEDURE
1818
@EventSessionName sysname = N'system_health',
1919
@TargetSessionType sysname = NULL,
2020
@VictimsOnly bit = 0,
21-
@DeadlockType nvarchar(20) = NULL,
22-
@Debug bit = 0,
21+
@DeadlockType nvarchar(20) = NULL,
22+
@Debug bit = 0,
2323
@Help bit = 0,
2424
@Version varchar(30) = NULL OUTPUT,
2525
@VersionDate datetime = NULL OUTPUT,
@@ -709,18 +709,18 @@ BEGIN
709709
END CATCH;
710710
END;
711711

712-
IF @DeadlockType IS NOT NULL
713-
BEGIN
714-
SELECT
715-
@DeadlockType =
716-
CASE
717-
WHEN LOWER(@DeadlockType) LIKE 'regular%'
718-
THEN N'Regular Deadlock'
719-
WHEN LOWER(@DeadlockType) LIKE N'parallel%'
720-
THEN N'Parallel Deadlock'
721-
ELSE NULL
722-
END;
723-
END;
712+
IF @DeadlockType IS NOT NULL
713+
BEGIN
714+
SELECT
715+
@DeadlockType =
716+
CASE
717+
WHEN LOWER(@DeadlockType) LIKE 'regular%'
718+
THEN N'Regular Deadlock'
719+
WHEN LOWER(@DeadlockType) LIKE N'parallel%'
720+
THEN N'Parallel Deadlock'
721+
ELSE NULL
722+
END;
723+
END;
724724

725725
/*If @TargetSessionType, we need to figure out if it's ring buffer or event file*/
726726
/*Azure has differently named views, so we need to separate. Thanks, Azure.*/
@@ -3463,8 +3463,8 @@ BEGIN
34633463
AND (d.client_app = @AppName OR @AppName IS NULL)
34643464
AND (d.host_name = @HostName OR @HostName IS NULL)
34653465
AND (d.login_name = @LoginName OR @LoginName IS NULL)
3466-
AND (d.deadlock_type = @DeadlockType OR @DeadlockType IS NULL)
3467-
OPTION (RECOMPILE, LOOP JOIN, HASH JOIN);
3466+
AND (d.deadlock_type = @DeadlockType OR @DeadlockType IS NULL)
3467+
OPTION (RECOMPILE, LOOP JOIN, HASH JOIN);
34683468

34693469
UPDATE d
34703470
SET d.inputbuf =
@@ -3851,7 +3851,11 @@ BEGIN
38513851
deqs.max_reserved_threads,
38523852
deqs.min_used_threads,
38533853
deqs.max_used_threads,
3854-
deqs.total_rows
3854+
deqs.total_rows,
3855+
max_worker_time_ms =
3856+
deqs.max_worker_time / 1000.,
3857+
max_elapsed_time_ms =
3858+
deqs.max_elapsed_time / 1000.
38553859
INTO #dm_exec_query_stats
38563860
FROM sys.dm_exec_query_stats AS deqs
38573861
WHERE EXISTS
@@ -3883,8 +3887,10 @@ BEGIN
38833887
ap.executions_per_second,
38843888
ap.total_worker_time_ms,
38853889
ap.avg_worker_time_ms,
3890+
ap.max_worker_time_ms,
38863891
ap.total_elapsed_time_ms,
38873892
ap.avg_elapsed_time_ms,
3893+
ap.max_elapsed_time_ms,
38883894
ap.total_logical_reads_mb,
38893895
ap.total_physical_reads_mb,
38903896
ap.total_logical_writes_mb,
@@ -3927,7 +3933,9 @@ BEGIN
39273933
c.min_used_threads,
39283934
c.max_used_threads,
39293935
c.total_rows,
3930-
c.query_plan
3936+
c.query_plan,
3937+
c.max_worker_time_ms,
3938+
c.max_elapsed_time_ms
39313939
FROM #available_plans AS ap
39323940
OUTER APPLY
39333941
(
@@ -4078,8 +4086,8 @@ BEGIN
40784086
@TargetSessionType,
40794087
VictimsOnly =
40804088
@VictimsOnly,
4081-
DeadlockType =
4082-
@DeadlockType,
4089+
DeadlockType =
4090+
@DeadlockType,
40834091
Debug =
40844092
@Debug,
40854093
Help =

0 commit comments

Comments
 (0)