Skip to content

Commit 4fb4590

Browse files
authored
Merge pull request #3054 from wqweto/fix/forward_fetches
Add `total_forwarded_fetch_count` to output table of sp_BlitzIndex
2 parents c1a8797 + abbe4b9 commit 4fb4590

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
@@ -5207,7 +5207,12 @@ ELSE IF (@Mode=1) /*Summarize*/
52075207
IF EXISTS(SELECT * FROM @@@OutputServerName@@@.@@@OutputDatabaseName@@@.INFORMATION_SCHEMA.SCHEMATA WHERE QUOTENAME(SCHEMA_NAME) = ''@@@OutputSchemaName@@@'')
52085208
SET @SchemaExists = 1
52095209
IF EXISTS (SELECT * FROM @@@OutputServerName@@@.@@@OutputDatabaseName@@@.INFORMATION_SCHEMA.TABLES WHERE QUOTENAME(TABLE_SCHEMA) = ''@@@OutputSchemaName@@@'' AND QUOTENAME(TABLE_NAME) = ''@@@OutputTableName@@@'')
5210-
SET @TableExists = 1';
5210+
BEGIN
5211+
SET @TableExists = 1
5212+
IF NOT EXISTS(SELECT * FROM @@@OutputServerName@@@.@@@OutputDatabaseName@@@.INFORMATION_SCHEMA.COLUMNS WHERE QUOTENAME(TABLE_SCHEMA) = ''@@@OutputSchemaName@@@''
5213+
AND QUOTENAME(TABLE_NAME) = ''@@@OutputTableName@@@'' AND QUOTENAME(COLUMN_NAME) = ''[total_forwarded_fetch_count]'')
5214+
EXEC @@@OutputServerName@@@.@@@OutputDatabaseName@@@.dbo.sp_executesql N''ALTER TABLE @@@OutputSchemaName@@@.@@@OutputTableName@@@ ADD [total_forwarded_fetch_count] BIGINT''
5215+
END';
52115216

52125217
SET @StringToExecute = REPLACE(@StringToExecute, '@@@OutputServerName@@@', @OutputServerName);
52135218
SET @StringToExecute = REPLACE(@StringToExecute, '@@@OutputDatabaseName@@@', @OutputDatabaseName);
@@ -5287,6 +5292,7 @@ ELSE IF (@Mode=1) /*Summarize*/
52875292
[avg_page_lock_wait_in_ms] BIGINT,
52885293
[total_index_lock_promotion_attempt_count] BIGINT,
52895294
[total_index_lock_promotion_count] BIGINT,
5295+
[total_forwarded_fetch_count] BIGINT,
52905296
[data_compression_desc] NVARCHAR(4000),
52915297
[page_latch_wait_count] BIGINT,
52925298
[page_latch_wait_in_ms] BIGINT,
@@ -5398,6 +5404,7 @@ ELSE IF (@Mode=1) /*Summarize*/
53985404
[avg_page_lock_wait_in_ms],
53995405
[total_index_lock_promotion_attempt_count],
54005406
[total_index_lock_promotion_count],
5407+
[total_forwarded_fetch_count],
54015408
[data_compression_desc],
54025409
[page_latch_wait_count],
54035410
[page_latch_wait_in_ms],
@@ -5488,6 +5495,7 @@ ELSE IF (@Mode=1) /*Summarize*/
54885495
sz.avg_page_lock_wait_in_ms AS [Avg Page Lock Wait ms],
54895496
sz.total_index_lock_promotion_attempt_count AS [Lock Escalation Attempts],
54905497
sz.total_index_lock_promotion_count AS [Lock Escalations],
5498+
sz.total_forwarded_fetch_count AS [Forwarded Fetches],
54915499
sz.data_compression_desc AS [Data Compression],
54925500
sz.page_latch_wait_count,
54935501
sz.page_latch_wait_in_ms,

0 commit comments

Comments
 (0)