Skip to content

Instantly share code, notes, and snippets.

@srkirkland
Created May 20, 2015 00:05
Show Gist options
  • Save srkirkland/1b9a1f23ff0e75a6d5d1 to your computer and use it in GitHub Desktop.
Save srkirkland/1b9a1f23ff0e75a6d5d1 to your computer and use it in GitHub Desktop.
database fragmentation
SELECT name, avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (
DB_ID(N'PrePurchasing')
, OBJECT_ID('PrePurchasing')
, 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