Skip to content

Commit 782540e

Browse files
authored
Merge pull request BrentOzarULTD#3910 from BrentOzarULTD/copilot/add-size-details-fill-factor-warning
sp_Blitz: add per-fill-factor total size (GB) to “Fill Factor Changed” details
2 parents cc80103 + 9792032 commit 782540e

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

sp_Blitz.sql

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7491,10 +7491,18 @@ IF NOT EXISTS ( SELECT 1
74917491
''Performance'' AS FindingsGroup,
74927492
''Fill Factor Changed'',
74937493
''https://www.brentozar.com/go/fillfactor'' AS URL,
7494-
''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.''
7495-
FROM [?].sys.indexes
7496-
WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0
7497-
GROUP BY fill_factor OPTION (RECOMPILE);';
7494+
''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.''
7495+
FROM [?].sys.indexes AS i
7496+
LEFT JOIN
7497+
(
7498+
SELECT ps.object_id, ps.index_id, SUM(ps.reserved_page_count) AS reserved_page_count
7499+
FROM [?].sys.dm_db_partition_stats AS ps
7500+
GROUP BY ps.object_id, ps.index_id
7501+
) AS ps ON i.object_id = ps.object_id AND i.index_id = ps.index_id
7502+
WHERE i.fill_factor <> 0 AND i.fill_factor < 80 AND i.is_disabled = 0 AND i.is_hypothetical = 0
7503+
GROUP BY i.fill_factor
7504+
HAVING SUM(ISNULL(ps.reserved_page_count, 0)) >= 2560
7505+
OPTION (RECOMPILE);';
74987506
END;
74997507

75007508
IF NOT EXISTS ( SELECT 1

0 commit comments

Comments
 (0)