Skip to content

Commit

Permalink
Merge pull request #3546 from erikdarlingdata/dev
Browse files Browse the repository at this point in the history
Closes #3545
  • Loading branch information
BrentOzar authored Jun 30, 2024
2 parents bcfea44 + a3a444e commit 23e70d0
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions sp_BlitzLock.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ ALTER PROCEDURE
@EventSessionName sysname = N'system_health',
@TargetSessionType sysname = NULL,
@VictimsOnly bit = 0,
@DeadlockType nvarchar(20) = NULL,
@Debug bit = 0,
@DeadlockType nvarchar(20) = NULL,
@Debug bit = 0,
@Help bit = 0,
@Version varchar(30) = NULL OUTPUT,
@VersionDate datetime = NULL OUTPUT,
Expand Down Expand Up @@ -709,18 +709,18 @@ BEGIN
END CATCH;
END;

IF @DeadlockType IS NOT NULL
BEGIN
SELECT
@DeadlockType =
CASE
WHEN LOWER(@DeadlockType) LIKE 'regular%'
THEN N'Regular Deadlock'
WHEN LOWER(@DeadlockType) LIKE N'parallel%'
THEN N'Parallel Deadlock'
ELSE NULL
END;
END;
IF @DeadlockType IS NOT NULL
BEGIN
SELECT
@DeadlockType =
CASE
WHEN LOWER(@DeadlockType) LIKE 'regular%'
THEN N'Regular Deadlock'
WHEN LOWER(@DeadlockType) LIKE N'parallel%'
THEN N'Parallel Deadlock'
ELSE NULL
END;
END;

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

UPDATE d
SET d.inputbuf =
Expand Down Expand Up @@ -3851,7 +3851,11 @@ BEGIN
deqs.max_reserved_threads,
deqs.min_used_threads,
deqs.max_used_threads,
deqs.total_rows
deqs.total_rows,
max_worker_time_ms =
deqs.max_worker_time / 1000.,
max_elapsed_time_ms =
deqs.max_elapsed_time / 1000.
INTO #dm_exec_query_stats
FROM sys.dm_exec_query_stats AS deqs
WHERE EXISTS
Expand Down Expand Up @@ -3883,8 +3887,10 @@ BEGIN
ap.executions_per_second,
ap.total_worker_time_ms,
ap.avg_worker_time_ms,
ap.max_worker_time_ms,
ap.total_elapsed_time_ms,
ap.avg_elapsed_time_ms,
ap.max_elapsed_time_ms,
ap.total_logical_reads_mb,
ap.total_physical_reads_mb,
ap.total_logical_writes_mb,
Expand Down Expand Up @@ -3927,7 +3933,9 @@ BEGIN
c.min_used_threads,
c.max_used_threads,
c.total_rows,
c.query_plan
c.query_plan,
c.max_worker_time_ms,
c.max_elapsed_time_ms
FROM #available_plans AS ap
OUTER APPLY
(
Expand Down Expand Up @@ -4078,8 +4086,8 @@ BEGIN
@TargetSessionType,
VictimsOnly =
@VictimsOnly,
DeadlockType =
@DeadlockType,
DeadlockType =
@DeadlockType,
Debug =
@Debug,
Help =
Expand Down

0 comments on commit 23e70d0

Please sign in to comment.