Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fillfactor indexes #204

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions BPCheck/Check_BP_Servers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13434,6 +13434,39 @@ BEGIN
END;
END;

--------------------------------------------------------------------------------------------------------------------------------
---
---
--### Indexes with fill factor = 100 pct subsection
-- - You can set @ptochecks to OFF in this block if you want to skip more performance tuning and optimization oriented checks.
--------------------------------------------------------------------------------------------------------------------------------
IF @ptochecks = 1
BEGIN
RAISERROR (N' |-Starting Indexes with fill factor = 100 pct', 10, 1) WITH NOWAIT
IF (SELECT COUNT(*)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about?
IF EXISTS (SELECT TOP 1 1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I just reused the code that is currently in the stored procedure. Yes in some situations it could exists big differences in performance but in this case is just metadata information and not thousands of rows so differences in performance are not expected.

FROM tempdb.dbo.tblIxs1 I
JOIN #tmpIPS F ON I.databaseid = F.database_id and I.objectID = F.object_id
AND I.indexID = F.index_id
WHERE [fill_factor] IN(0,100)
AND fragmentation > 5 AND [page_count] > 8
) > 0
BEGIN
SELECT 'Index_and_Stats_checks' AS [Category], 'Full_Fill_Factor' AS [Check], '[WARNING: Some fragmented indexes have a fill factor 100 percent. Revise the need to maintain this value]' AS [Deviation]
SELECT 'Index_and_Stats_checks' AS [Category], 'Full_Fill_Factor' AS [Information], I.[DatabaseName] AS [Database_Name], I.schemaName AS [Schema_Name], I.[objectName] AS [Table_Name], I.[indexID], I.[indexName] AS [Index_Name],
[partition_number], [fragmentation], [fill_factor], I.KeyCols, I.IncludedCols, CASE WHEN I.IncludedCols IS NULL THEN I.[KeyCols] ELSE I.[KeyCols] + ',' + I.IncludedCols END AS [AllColsOrdered]
FROM tempdb.dbo.tblIxs1 I
JOIN #tmpIPS F ON I.databaseid = F.database_id and I.objectID = F.object_id
AND I.indexID = F.index_id
WHERE [fill_factor] IN(0,100)
AND fragmentation > 5 AND [page_count] > 8
ORDER BY I.[DatabaseName], I.schemaName, I.[objectName], I.[indexID]
END
ELSE
BEGIN
SELECT 'Index_and_Stats_checks' AS [Category], 'Full_Fill_Factor' AS [Check], '[OK]' AS [Deviation]
END;
END;

--------------------------------------------------------------------------------------------------------------------------------
---
---
Expand Down