Skip to content

Commit 46d4e4a

Browse files
CopilotBrentOzar
andauthored
sp_Blitz: include total GB size in Fill Factor Changed details
Agent-Logs-Url: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/sessions/5c4abca1-268f-4bf9-928e-fe6af94f899d Co-authored-by: BrentOzar <245462+BrentOzar@users.noreply.github.com>
1 parent 3ccef72 commit 46d4e4a

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

Install-All-Scripts.sql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7497,10 +7497,16 @@ IF NOT EXISTS ( SELECT 1
74977497
''Performance'' AS FindingsGroup,
74987498
''Fill Factor Changed'',
74997499
''https://www.brentozar.com/go/fillfactor'' AS URL,
7500-
''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.''
7501-
FROM [?].sys.indexes
7502-
WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0
7503-
GROUP BY fill_factor OPTION (RECOMPILE);';
7500+
''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(i.fill_factor AS NVARCHAR(5)) + ''%, taking up a total size of '' + CAST(CAST(SUM(ISNULL(ps.reserved_page_count, 0)) * 8.0 / 1024 / 1024 AS DECIMAL(18,2)) AS NVARCHAR(50)) + '' GB. This can cause memory and storage performance problems.''
7501+
FROM [?].sys.indexes AS i
7502+
LEFT JOIN
7503+
(
7504+
SELECT ps.object_id, ps.index_id, SUM(ps.reserved_page_count) AS reserved_page_count
7505+
FROM [?].sys.dm_db_partition_stats AS ps
7506+
GROUP BY ps.object_id, ps.index_id
7507+
) AS ps ON i.object_id = ps.object_id AND i.index_id = ps.index_id
7508+
WHERE i.fill_factor <> 0 AND i.fill_factor < 80 AND i.is_disabled = 0 AND i.is_hypothetical = 0
7509+
GROUP BY i.fill_factor OPTION (RECOMPILE);';
75047510
END;
75057511

75067512
IF NOT EXISTS ( SELECT 1

sp_Blitz.sql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7495,10 +7495,16 @@ IF NOT EXISTS ( SELECT 1
74957495
''Performance'' AS FindingsGroup,
74967496
''Fill Factor Changed'',
74977497
''https://www.brentozar.com/go/fillfactor'' AS URL,
7498-
''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.''
7499-
FROM [?].sys.indexes
7500-
WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0
7501-
GROUP BY fill_factor OPTION (RECOMPILE);';
7498+
''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(i.fill_factor AS NVARCHAR(5)) + ''%, taking up a total size of '' + CAST(CAST(SUM(ISNULL(ps.reserved_page_count, 0)) * 8.0 / 1024 / 1024 AS DECIMAL(18,2)) AS NVARCHAR(50)) + '' GB. This can cause memory and storage performance problems.''
7499+
FROM [?].sys.indexes AS i
7500+
LEFT JOIN
7501+
(
7502+
SELECT ps.object_id, ps.index_id, SUM(ps.reserved_page_count) AS reserved_page_count
7503+
FROM [?].sys.dm_db_partition_stats AS ps
7504+
GROUP BY ps.object_id, ps.index_id
7505+
) AS ps ON i.object_id = ps.object_id AND i.index_id = ps.index_id
7506+
WHERE i.fill_factor <> 0 AND i.fill_factor < 80 AND i.is_disabled = 0 AND i.is_hypothetical = 0
7507+
GROUP BY i.fill_factor OPTION (RECOMPILE);';
75027508
END;
75037509

75047510
IF NOT EXISTS ( SELECT 1

0 commit comments

Comments
 (0)