Created
June 3, 2017 11:18
-
-
Save josephhanson/549bbf89f27c3320c1ac13955e1dc7e3 to your computer and use it in GitHub Desktop.
SQL - Page Fragmentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT a.index_id, name, avg_fragmentation_in_percent, fragment_count, | |
avg_fragment_size_in_pages | |
FROM sys.dm_db_index_physical_stats(DB_ID('database'), | |
OBJECT_ID('table'), NULL, NULL, NULL) AS a | |
JOIN sys.indexes AS b ON a.OBJECT_ID = b.OBJECT_ID AND a.index_id = b.index_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment