37
37
SET NOCOUNT ON;
38
38
SET STATISTICS XML OFF;
39
39
40
- SELECT @Version = '8.20 ', @VersionDate = '20240522 ';
40
+ SELECT @Version = '8.21 ', @VersionDate = '20240701 ';
41
41
42
42
IF(@VersionCheckMode = 1)
43
43
BEGIN
@@ -1172,7 +1172,7 @@ SET NOCOUNT ON;
1172
1172
SET STATISTICS XML OFF;
1173
1173
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1174
1174
1175
- SELECT @Version = '8.20 ', @VersionDate = '20240522 ';
1175
+ SELECT @Version = '8.21 ', @VersionDate = '20240701 ';
1176
1176
SET @OutputType = UPPER(@OutputType);
1177
1177
1178
1178
IF(@VersionCheckMode = 1)
@@ -8545,7 +8545,7 @@ SET NOCOUNT ON;
8545
8545
SET STATISTICS XML OFF;
8546
8546
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
8547
8547
8548
- SELECT @Version = '8.20 ', @VersionDate = '20240522 ';
8548
+ SELECT @Version = '8.21 ', @VersionDate = '20240701 ';
8549
8549
8550
8550
IF(@VersionCheckMode = 1)
8551
8551
BEGIN
@@ -13554,7 +13554,7 @@ SET NOCOUNT ON;
13554
13554
SET STATISTICS XML OFF;
13555
13555
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
13556
13556
13557
- SELECT @Version = '8.20 ', @VersionDate = '20240522 ';
13557
+ SELECT @Version = '8.21 ', @VersionDate = '20240701 ';
13558
13558
SET @OutputType = UPPER(@OutputType);
13559
13559
13560
13560
IF(@VersionCheckMode = 1)
@@ -20029,6 +20029,7 @@ ALTER PROCEDURE
20029
20029
@EventSessionName sysname = N'system_health',
20030
20030
@TargetSessionType sysname = NULL,
20031
20031
@VictimsOnly bit = 0,
20032
+ @DeadlockType nvarchar(20) = NULL,
20032
20033
@Debug bit = 0,
20033
20034
@Help bit = 0,
20034
20035
@Version varchar(30) = NULL OUTPUT,
@@ -20047,7 +20048,7 @@ BEGIN
20047
20048
SET XACT_ABORT OFF;
20048
20049
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
20049
20050
20050
- SELECT @Version = '8.20 ', @VersionDate = '20240522 ';
20051
+ SELECT @Version = '8.21 ', @VersionDate = '20240701 ';
20051
20052
20052
20053
IF @VersionCheckMode = 1
20053
20054
BEGIN
@@ -20209,7 +20210,7 @@ BEGIN
20209
20210
@StartDateOriginal datetime = @StartDate,
20210
20211
@EndDateOriginal datetime = @EndDate,
20211
20212
@StartDateUTC datetime,
20212
- @EndDateUTC datetime;
20213
+ @EndDateUTC datetime;;
20213
20214
20214
20215
/*Temporary objects used in the procedure*/
20215
20216
DECLARE
@@ -20719,50 +20720,63 @@ BEGIN
20719
20720
END CATCH;
20720
20721
END;
20721
20722
20723
+ IF @DeadlockType IS NOT NULL
20724
+ BEGIN
20725
+ SELECT
20726
+ @DeadlockType =
20727
+ CASE
20728
+ WHEN LOWER(@DeadlockType) LIKE 'regular%'
20729
+ THEN N'Regular Deadlock'
20730
+ WHEN LOWER(@DeadlockType) LIKE N'parallel%'
20731
+ THEN N'Parallel Deadlock'
20732
+ ELSE NULL
20733
+ END;
20734
+ END;
20735
+
20722
20736
/*If @TargetSessionType, we need to figure out if it's ring buffer or event file*/
20723
20737
/*Azure has differently named views, so we need to separate. Thanks, Azure.*/
20724
20738
20725
- IF
20726
- (
20727
- @Azure = 0
20728
- AND @TargetSessionType IS NULL
20729
- )
20730
- BEGIN
20731
- RAISERROR('@TargetSessionType is NULL, assigning for non-Azure instance', 0, 1) WITH NOWAIT;
20739
+ IF
20740
+ (
20741
+ @Azure = 0
20742
+ AND @TargetSessionType IS NULL
20743
+ )
20744
+ BEGIN
20745
+ RAISERROR('@TargetSessionType is NULL, assigning for non-Azure instance', 0, 1) WITH NOWAIT;
20732
20746
20733
- SELECT TOP (1)
20734
- @TargetSessionType = t.target_name
20735
- FROM sys.dm_xe_sessions AS s
20736
- JOIN sys.dm_xe_session_targets AS t
20737
- ON s.address = t.event_session_address
20738
- WHERE s.name = @EventSessionName
20739
- AND t.target_name IN (N'event_file', N'ring_buffer')
20740
- ORDER BY t.target_name
20741
- OPTION(RECOMPILE);
20747
+ SELECT TOP (1)
20748
+ @TargetSessionType = t.target_name
20749
+ FROM sys.dm_xe_sessions AS s
20750
+ JOIN sys.dm_xe_session_targets AS t
20751
+ ON s.address = t.event_session_address
20752
+ WHERE s.name = @EventSessionName
20753
+ AND t.target_name IN (N'event_file', N'ring_buffer')
20754
+ ORDER BY t.target_name
20755
+ OPTION(RECOMPILE);
20742
20756
20743
- RAISERROR('@TargetSessionType assigned as %s for non-Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
20744
- END;
20757
+ RAISERROR('@TargetSessionType assigned as %s for non-Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
20758
+ END;
20745
20759
20746
- IF
20747
- (
20748
- @Azure = 1
20749
- AND @TargetSessionType IS NULL
20750
- )
20751
- BEGIN
20752
- RAISERROR('@TargetSessionType is NULL, assigning for Azure instance', 0, 1) WITH NOWAIT;
20760
+ IF
20761
+ (
20762
+ @Azure = 1
20763
+ AND @TargetSessionType IS NULL
20764
+ )
20765
+ BEGIN
20766
+ RAISERROR('@TargetSessionType is NULL, assigning for Azure instance', 0, 1) WITH NOWAIT;
20753
20767
20754
- SELECT TOP (1)
20755
- @TargetSessionType = t.target_name
20756
- FROM sys.dm_xe_database_sessions AS s
20757
- JOIN sys.dm_xe_database_session_targets AS t
20758
- ON s.address = t.event_session_address
20759
- WHERE s.name = @EventSessionName
20760
- AND t.target_name IN (N'event_file', N'ring_buffer')
20761
- ORDER BY t.target_name
20762
- OPTION(RECOMPILE);
20768
+ SELECT TOP (1)
20769
+ @TargetSessionType = t.target_name
20770
+ FROM sys.dm_xe_database_sessions AS s
20771
+ JOIN sys.dm_xe_database_session_targets AS t
20772
+ ON s.address = t.event_session_address
20773
+ WHERE s.name = @EventSessionName
20774
+ AND t.target_name IN (N'event_file', N'ring_buffer')
20775
+ ORDER BY t.target_name
20776
+ OPTION(RECOMPILE);
20763
20777
20764
- RAISERROR('@TargetSessionType assigned as %s for Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
20765
- END;
20778
+ RAISERROR('@TargetSessionType assigned as %s for Azure', 0, 1, @TargetSessionType) WITH NOWAIT;
20779
+ END;
20766
20780
20767
20781
20768
20782
/*The system health stuff gets handled different from user extended events.*/
@@ -23460,6 +23474,7 @@ BEGIN
23460
23474
AND (d.client_app = @AppName OR @AppName IS NULL)
23461
23475
AND (d.host_name = @HostName OR @HostName IS NULL)
23462
23476
AND (d.login_name = @LoginName OR @LoginName IS NULL)
23477
+ AND (d.deadlock_type = @DeadlockType OR @DeadlockType IS NULL)
23463
23478
OPTION (RECOMPILE, LOOP JOIN, HASH JOIN);
23464
23479
23465
23480
UPDATE d
@@ -23847,7 +23862,11 @@ BEGIN
23847
23862
deqs.max_reserved_threads,
23848
23863
deqs.min_used_threads,
23849
23864
deqs.max_used_threads,
23850
- deqs.total_rows
23865
+ deqs.total_rows,
23866
+ max_worker_time_ms =
23867
+ deqs.max_worker_time / 1000.,
23868
+ max_elapsed_time_ms =
23869
+ deqs.max_elapsed_time / 1000.
23851
23870
INTO #dm_exec_query_stats
23852
23871
FROM sys.dm_exec_query_stats AS deqs
23853
23872
WHERE EXISTS
@@ -23879,8 +23898,10 @@ BEGIN
23879
23898
ap.executions_per_second,
23880
23899
ap.total_worker_time_ms,
23881
23900
ap.avg_worker_time_ms,
23901
+ ap.max_worker_time_ms,
23882
23902
ap.total_elapsed_time_ms,
23883
23903
ap.avg_elapsed_time_ms,
23904
+ ap.max_elapsed_time_ms,
23884
23905
ap.total_logical_reads_mb,
23885
23906
ap.total_physical_reads_mb,
23886
23907
ap.total_logical_writes_mb,
@@ -23923,7 +23944,9 @@ BEGIN
23923
23944
c.min_used_threads,
23924
23945
c.max_used_threads,
23925
23946
c.total_rows,
23926
- c.query_plan
23947
+ c.query_plan,
23948
+ c.max_worker_time_ms,
23949
+ c.max_elapsed_time_ms
23927
23950
FROM #available_plans AS ap
23928
23951
OUTER APPLY
23929
23952
(
@@ -24074,6 +24097,8 @@ BEGIN
24074
24097
@TargetSessionType,
24075
24098
VictimsOnly =
24076
24099
@VictimsOnly,
24100
+ DeadlockType =
24101
+ @DeadlockType,
24077
24102
Debug =
24078
24103
@Debug,
24079
24104
Help =
@@ -24178,7 +24203,7 @@ BEGIN
24178
24203
SET STATISTICS XML OFF;
24179
24204
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
24180
24205
24181
- SELECT @Version = '8.20 ', @VersionDate = '20240522 ';
24206
+ SELECT @Version = '8.21 ', @VersionDate = '20240701 ';
24182
24207
24183
24208
IF(@VersionCheckMode = 1)
24184
24209
BEGIN
0 commit comments