@@ -172,11 +172,11 @@ DECLARE
172172-- 1420: The minumum number of blocked tasks observed at the time of each 20-second snapshot to be considered significant
173173@LockBlockingBlockedTaskThreshold int = 1 ,
174174
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 ,
177177
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 ,
180180
181181-- 1450: The minimum local storage usage ratio to be considered significant
182182@MinLocalStorageQuotaUsageRatio decimal (3 ,2 ) = 0 .85 ,
@@ -298,7 +298,7 @@ VALUES
298298(1 , 1400 , ' Some statistics may be out of date' , 70 , ' https://aka.ms/sqldbtipswiki#tip_id-1400' , ' VIEW DATABASE STATE' ),
299299(1 , 1410 , ' Many tables do not have any indexes' , 60 , ' https://aka.ms/sqldbtipswiki#tip_id-1410' , ' VIEW DATABASE STATE' ),
300300(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' ),
302302(1 , 1440 , ' Row locks or page locks are disabled for some indexes' , 90 , ' https://aka.ms/sqldbtipswiki#tip_id-1440' , ' VIEW DATABASE STATE' ),
303303(1 , 1450 , ' Allocated local storage is close to maximum local storage' , 90 , ' https://aka.ms/sqldbtipswiki#tip_id-1450' , ' VIEW SERVER STATE' ),
304304(1 , 1460 , ' Column collation does not match database collation' , 70 , ' https://aka.ms/sqldbtipswiki#tip_id-1460' , ' VIEW DATABASE STATE' ),
@@ -3872,69 +3872,69 @@ FROM packed_blocking_snapshot
38723872HAVING COUNT (1 ) > 0
38733873;
38743874
3875- -- High query compilations
3875+ -- High query optimizations
38763876IF EXISTS (SELECT 1 FROM @TipDefinition WHERE tip_id IN (1430 ) AND execute_indicator = 1 )
38773877
38783878WITH
3879- high_compilation_snapshot AS
3879+ high_optimizations_snapshot AS
38803880(
38813881SELECT snapshot_time,
38823882 duration_ms,
38833883 delta_request_count,
38843884 delta_query_optimizations,
3885- IIF (delta_query_optimizations > @QueryCompilationRequestThresholdRatio * delta_request_count AND delta_request_count >= @QueryCompilationRequestCountThreshold , 1 , 0 ) AS high_compilation_indicator
3885+ IIF (delta_query_optimizations > @QueryOptimizationRequestThresholdRatio * delta_request_count AND delta_request_count >= @QueryOptimizationRequestCountThreshold , 1 , 0 ) AS high_optimizations_indicator
38863886FROM sys .dm_resource_governor_workload_groups_history_ex
38873887WHERE @EngineEdition = 5
38883888 AND
38893889 name like ' UserPrimaryGroup.DB%'
38903890 AND
38913891 TRY_CAST (RIGHT (name , LEN (name ) - LEN (' UserPrimaryGroup.DB' ) - 2 ) AS int ) = DB_ID ()
38923892),
3893- pre_packed_high_compilation_snapshot AS
3893+ pre_packed_high_optimizations_snapshot AS
38943894(
38953895SELECT snapshot_time,
38963896 duration_ms,
38973897 delta_request_count,
38983898 delta_query_optimizations,
3899- high_compilation_indicator ,
3899+ high_optimizations_indicator ,
39003900 ROW_NUMBER () OVER (ORDER BY snapshot_time)
39013901 -
3902- SUM (high_compilation_indicator ) OVER (ORDER BY snapshot_time ROWS UNBOUNDED PRECEDING )
3902+ SUM (high_optimizations_indicator ) OVER (ORDER BY snapshot_time ROWS UNBOUNDED PRECEDING )
39033903 AS grouping_helper
3904- FROM high_compilation_snapshot
3904+ FROM high_optimizations_snapshot
39053905),
3906- packed_high_compilation_snapshot AS
3906+ packed_high_optimization_snapshot AS
39073907(
39083908SELECT MIN (snapshot_time) AS min_snapshot_time,
39093909 MAX (snapshot_time) AS max_snapshot_time,
39103910 AVG (duration_ms) AS avg_snapshot_interval_duration_ms,
39113911 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
3912+ SUM (delta_query_optimizations) AS total_optimizations
3913+ FROM pre_packed_high_optimizations_snapshot
3914+ WHERE high_optimizations_indicator = 1
39153915GROUP BY grouping_helper
39163916)
39173917INSERT INTO @DetectedTip (tip_id, details)
39183918SELECT 1430 AS tip_id,
39193919 CONCAT (
39203920 @NbspCRLF,
3921- ' Time intervals with a high number of query compilations (UTC):' ,
3921+ ' Time intervals with a high number of query optimizations (UTC):' ,
39223922 @CRLF, @CRLF,
39233923 STRING_AGG (
39243924 CAST (CONCAT (
39253925 ' Interval start time: ' , FORMAT (DATEADD (millisecond , - avg_snapshot_interval_duration_ms, min_snapshot_time), ' s' ),
39263926 ' , end time: ' , FORMAT (max_snapshot_time, ' s' ),
39273927 ' , 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 ))),
39283928 ' , 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' )
3929+ ' , total optimizations : ' , FORMAT (total_optimizations , ' #,0' ),
3930+ ' , query optimization rate: ' , FORMAT (LEAST(total_optimizations * 1 .0 / total_requests, 1 ), ' P' )
39313931 ) AS nvarchar (max )), @CRLF
39323932 )
39333933 WITHIN GROUP (ORDER BY min_snapshot_time DESC ),
39343934 @CRLF
39353935 )
39363936 AS details
3937- FROM packed_high_compilation_snapshot
3937+ FROM packed_high_optimization_snapshot
39383938HAVING COUNT (1 ) > 0
39393939;
39403940
0 commit comments