@@ -172,11 +172,11 @@ DECLARE
172
172
-- 1420: The minumum number of blocked tasks observed at the time of each 20-second snapshot to be considered significant
173
173
@LockBlockingBlockedTaskThreshold int = 1 ,
174
174
175
- -- 1430: The minimum number of requests in an interval to start considering if query compilations are high
176
- @QueryCompilationRequestCountThreshold smallint = 100 ,
175
+ -- 1430: The minimum number of requests in an interval to start considering if query optimizations are high
176
+ @QueryOptimizationRequestCountThreshold smallint = 100 ,
177
177
178
- -- 1430: The minimum ratio of query compilations ( optimizations) to the number of requests to be considered significant
179
- @QueryCompilationRequestThresholdRatio decimal (3 ,2 ) = 0 .15 ,
178
+ -- 1430: The minimum ratio of query optimizations to the number of requests to be considered significant
179
+ @QueryOptimizationRequestThresholdRatio decimal (3 ,2 ) = 0 .15 ,
180
180
181
181
-- 1450: The minimum local storage usage ratio to be considered significant
182
182
@MinLocalStorageQuotaUsageRatio decimal (3 ,2 ) = 0 .85 ,
@@ -298,7 +298,7 @@ VALUES
298
298
(1 , 1400 , ' Some statistics may be out of date' , 70 , ' https://aka.ms/sqldbtipswiki#tip_id-1400' , ' VIEW DATABASE STATE' ),
299
299
(1 , 1410 , ' Many tables do not have any indexes' , 60 , ' https://aka.ms/sqldbtipswiki#tip_id-1410' , ' VIEW DATABASE STATE' ),
300
300
(1 , 1420 , ' Significant lock blocking has recently occurred' , 70 , ' https://aka.ms/sqldbtipswiki#tip_id-1420' , ' VIEW SERVER STATE' ),
301
- (1 , 1430 , ' The number of recent query compilations is high' , 80 , ' https://aka.ms/sqldbtipswiki#tip_id-1430' , ' VIEW SERVER STATE' ),
301
+ (1 , 1430 , ' The number of recent query optimizations is high' , 80 , ' https://aka.ms/sqldbtipswiki#tip_id-1430' , ' VIEW SERVER STATE' ),
302
302
(1 , 1440 , ' Row locks or page locks are disabled for some indexes' , 90 , ' https://aka.ms/sqldbtipswiki#tip_id-1440' , ' VIEW DATABASE STATE' ),
303
303
(1 , 1450 , ' Allocated local storage is close to maximum local storage' , 90 , ' https://aka.ms/sqldbtipswiki#tip_id-1450' , ' VIEW SERVER STATE' ),
304
304
(1 , 1460 , ' Column collation does not match database collation' , 70 , ' https://aka.ms/sqldbtipswiki#tip_id-1460' , ' VIEW DATABASE STATE' ),
@@ -1934,7 +1934,8 @@ SELECT 1510 AS tip_id,
1934
1934
' , initial identity value: ' , FORMAT (identity_seed, ' #,0' ),
1935
1935
' , current identity value: ' , FORMAT (current_identity_value, ' #,0' ),
1936
1936
' , identity increment: ' , FORMAT (identity_increment, ' #,0' ),
1937
- ' , data type range: ' , FORMAT (range_min, ' #,0' ), ' to ' , FORMAT (range_max, ' #,0' )
1937
+ ' , data type range: ' , FORMAT (range_min, ' #,0' ), ' to ' , FORMAT (range_max, ' #,0' ),
1938
+ ' , remaining contiguous range: ' , FORMAT (IIF (identity_increment > 0 , range_max_float - current_identity_value, range_min_float - current_identity_value), ' #,0' )
1938
1939
)
1939
1940
AS nvarchar (max )
1940
1941
),
@@ -1994,7 +1995,8 @@ SELECT 1520 AS tip_id,
1994
1995
' , start value: ' , FORMAT (start_value, ' #,0' ),
1995
1996
' , current value: ' , FORMAT (current_value, ' #,0' ),
1996
1997
' , increment: ' , FORMAT (increment, ' #,0' ),
1997
- ' , range: ' , FORMAT (minimum_value, ' #,0' ), ' to ' , FORMAT (maximum_value, ' #,0' ),
1998
+ ' , full range: ' , FORMAT (minimum_value, ' #,0' ), ' to ' , FORMAT (maximum_value, ' #,0' ),
1999
+ ' , remaining contiguous range: ' , FORMAT (IIF (increment > 0 , maximum_value - current_value, minimum_value - current_value), ' #,0' ),
1998
2000
' , exhausted: ' , IIF (is_exhausted = 1 , ' Yes' , ' No' )
1999
2001
)
2000
2002
AS nvarchar (max )
@@ -2006,8 +2008,8 @@ SELECT 1520 AS tip_id,
2006
2008
AS details
2007
2009
FROM sequence_object
2008
2010
WHERE -- less than x% of the maximum sequence range remains
2009
- CASE WHEN increment > 0 THEN (maximum_value - current_value) / (maximum_value - minimum_value )
2010
- WHEN increment < 0 THEN (minimum_value - current_value) / (minimum_value - maximum_value )
2011
+ CASE WHEN increment > 0 THEN (maximum_value - current_value) / (maximum_value - start_value )
2012
+ WHEN increment < 0 THEN (minimum_value - current_value) / (minimum_value - start_value )
2011
2013
END < @IdentitySequenceRangeExhaustionThresholdRatio
2012
2014
HAVING COUNT (1 ) > 0 ;
2013
2015
@@ -3872,69 +3874,69 @@ FROM packed_blocking_snapshot
3872
3874
HAVING COUNT (1 ) > 0
3873
3875
;
3874
3876
3875
- -- High query compilations
3877
+ -- High query optimizations
3876
3878
IF EXISTS (SELECT 1 FROM @TipDefinition WHERE tip_id IN (1430 ) AND execute_indicator = 1 )
3877
3879
3878
3880
WITH
3879
- high_compilation_snapshot AS
3881
+ high_optimizations_snapshot AS
3880
3882
(
3881
3883
SELECT snapshot_time,
3882
3884
duration_ms,
3883
3885
delta_request_count,
3884
3886
delta_query_optimizations,
3885
- IIF (delta_query_optimizations > @QueryCompilationRequestThresholdRatio * delta_request_count AND delta_request_count >= @QueryCompilationRequestCountThreshold , 1 , 0 ) AS high_compilation_indicator
3887
+ IIF (delta_query_optimizations > @QueryOptimizationRequestThresholdRatio * delta_request_count AND delta_request_count >= @QueryOptimizationRequestCountThreshold , 1 , 0 ) AS high_optimizations_indicator
3886
3888
FROM sys .dm_resource_governor_workload_groups_history_ex
3887
3889
WHERE @EngineEdition = 5
3888
3890
AND
3889
3891
name like ' UserPrimaryGroup.DB%'
3890
3892
AND
3891
3893
TRY_CAST (RIGHT (name , LEN (name ) - LEN (' UserPrimaryGroup.DB' ) - 2 ) AS int ) = DB_ID ()
3892
3894
),
3893
- pre_packed_high_compilation_snapshot AS
3895
+ pre_packed_high_optimizations_snapshot AS
3894
3896
(
3895
3897
SELECT snapshot_time,
3896
3898
duration_ms,
3897
3899
delta_request_count,
3898
3900
delta_query_optimizations,
3899
- high_compilation_indicator ,
3901
+ high_optimizations_indicator ,
3900
3902
ROW_NUMBER () OVER (ORDER BY snapshot_time)
3901
3903
-
3902
- SUM (high_compilation_indicator ) OVER (ORDER BY snapshot_time ROWS UNBOUNDED PRECEDING )
3904
+ SUM (high_optimizations_indicator ) OVER (ORDER BY snapshot_time ROWS UNBOUNDED PRECEDING )
3903
3905
AS grouping_helper
3904
- FROM high_compilation_snapshot
3906
+ FROM high_optimizations_snapshot
3905
3907
),
3906
- packed_high_compilation_snapshot AS
3908
+ packed_high_optimization_snapshot AS
3907
3909
(
3908
3910
SELECT MIN (snapshot_time) AS min_snapshot_time,
3909
3911
MAX (snapshot_time) AS max_snapshot_time,
3910
3912
AVG (duration_ms) AS avg_snapshot_interval_duration_ms,
3911
3913
SUM (delta_request_count) AS total_requests,
3912
- SUM (delta_query_optimizations) AS total_compilations
3913
- FROM pre_packed_high_compilation_snapshot
3914
- WHERE high_compilation_indicator = 1
3914
+ SUM (delta_query_optimizations) AS total_optimizations
3915
+ FROM pre_packed_high_optimizations_snapshot
3916
+ WHERE high_optimizations_indicator = 1
3915
3917
GROUP BY grouping_helper
3916
3918
)
3917
3919
INSERT INTO @DetectedTip (tip_id, details)
3918
3920
SELECT 1430 AS tip_id,
3919
3921
CONCAT (
3920
3922
@NbspCRLF,
3921
- ' Time intervals with a high number of query compilations (UTC):' ,
3923
+ ' Time intervals with a high number of query optimizations (UTC):' ,
3922
3924
@CRLF, @CRLF,
3923
3925
STRING_AGG (
3924
3926
CAST (CONCAT (
3925
3927
' Interval start time: ' , FORMAT (DATEADD (millisecond , - avg_snapshot_interval_duration_ms, min_snapshot_time), ' s' ),
3926
3928
' , end time: ' , FORMAT (max_snapshot_time, ' s' ),
3927
3929
' , duration: ' , DATEADD (second, DATEDIFF (second, DATEADD (millisecond , - avg_snapshot_interval_duration_ms, min_snapshot_time), max_snapshot_time), CAST (' 00:00:00' AS time (0 ))),
3928
3930
' , total requests: ' , FORMAT (total_requests, ' #,0' ),
3929
- ' , total compilations : ' , FORMAT (total_compilations , ' #,0' ),
3930
- ' , query compilation rate: ' , FORMAT (LEAST(total_compilations * 1 .0 / total_requests, 1 ), ' P' )
3931
+ ' , total optimizations : ' , FORMAT (total_optimizations , ' #,0' ),
3932
+ ' , query optimization rate: ' , FORMAT (LEAST(total_optimizations * 1 .0 / total_requests, 1 ), ' P' )
3931
3933
) AS nvarchar (max )), @CRLF
3932
3934
)
3933
3935
WITHIN GROUP (ORDER BY min_snapshot_time DESC ),
3934
3936
@CRLF
3935
3937
)
3936
3938
AS details
3937
- FROM packed_high_compilation_snapshot
3939
+ FROM packed_high_optimization_snapshot
3938
3940
HAVING COUNT (1 ) > 0
3939
3941
;
3940
3942
0 commit comments