Skip to content

Commit abbe4b9

Browse files
committed
Add total_forwarded_fetch_count to output table of sp_BlitzIndex
Fixes #3053
1 parent 9434afb commit abbe4b9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sp_BlitzIndex.sql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5203,7 +5203,12 @@ ELSE IF (@Mode=1) /*Summarize*/
52035203
IF EXISTS(SELECT * FROM @@@OutputServerName@@@.@@@OutputDatabaseName@@@.INFORMATION_SCHEMA.SCHEMATA WHERE QUOTENAME(SCHEMA_NAME) = ''@@@OutputSchemaName@@@'')
52045204
SET @SchemaExists = 1
52055205
IF EXISTS (SELECT * FROM @@@OutputServerName@@@.@@@OutputDatabaseName@@@.INFORMATION_SCHEMA.TABLES WHERE QUOTENAME(TABLE_SCHEMA) = ''@@@OutputSchemaName@@@'' AND QUOTENAME(TABLE_NAME) = ''@@@OutputTableName@@@'')
5206-
SET @TableExists = 1';
5206+
BEGIN
5207+
SET @TableExists = 1
5208+
IF NOT EXISTS(SELECT * FROM @@@OutputServerName@@@.@@@OutputDatabaseName@@@.INFORMATION_SCHEMA.COLUMNS WHERE QUOTENAME(TABLE_SCHEMA) = ''@@@OutputSchemaName@@@''
5209+
AND QUOTENAME(TABLE_NAME) = ''@@@OutputTableName@@@'' AND QUOTENAME(COLUMN_NAME) = ''[total_forwarded_fetch_count]'')
5210+
EXEC @@@OutputServerName@@@.@@@OutputDatabaseName@@@.dbo.sp_executesql N''ALTER TABLE @@@OutputSchemaName@@@.@@@OutputTableName@@@ ADD [total_forwarded_fetch_count] BIGINT''
5211+
END';
52075212

52085213
SET @StringToExecute = REPLACE(@StringToExecute, '@@@OutputServerName@@@', @OutputServerName);
52095214
SET @StringToExecute = REPLACE(@StringToExecute, '@@@OutputDatabaseName@@@', @OutputDatabaseName);
@@ -5283,6 +5288,7 @@ ELSE IF (@Mode=1) /*Summarize*/
52835288
[avg_page_lock_wait_in_ms] BIGINT,
52845289
[total_index_lock_promotion_attempt_count] BIGINT,
52855290
[total_index_lock_promotion_count] BIGINT,
5291+
[total_forwarded_fetch_count] BIGINT,
52865292
[data_compression_desc] NVARCHAR(4000),
52875293
[page_latch_wait_count] BIGINT,
52885294
[page_latch_wait_in_ms] BIGINT,
@@ -5394,6 +5400,7 @@ ELSE IF (@Mode=1) /*Summarize*/
53945400
[avg_page_lock_wait_in_ms],
53955401
[total_index_lock_promotion_attempt_count],
53965402
[total_index_lock_promotion_count],
5403+
[total_forwarded_fetch_count],
53975404
[data_compression_desc],
53985405
[page_latch_wait_count],
53995406
[page_latch_wait_in_ms],
@@ -5484,6 +5491,7 @@ ELSE IF (@Mode=1) /*Summarize*/
54845491
sz.avg_page_lock_wait_in_ms AS [Avg Page Lock Wait ms],
54855492
sz.total_index_lock_promotion_attempt_count AS [Lock Escalation Attempts],
54865493
sz.total_index_lock_promotion_count AS [Lock Escalations],
5494+
sz.total_forwarded_fetch_count AS [Forwarded Fetches],
54875495
sz.data_compression_desc AS [Data Compression],
54885496
sz.page_latch_wait_count,
54895497
sz.page_latch_wait_in_ms,

0 commit comments

Comments
 (0)