Wednesday, January 30, 2013
Tuesday, January 8, 2013
SQL Server Find Table Fragmentation
SELECT db.Name
, OBJECT_NAME(s.OBJECT_ID)
, s.avg_fragmentation_in_percent Perc
FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL, NULL, NULL) s
JOIN MASTER.DBO.SYSDATABASES db
ON s.database_id = db.dbID
WHERE s.database_id = 7
ORDER BY Perc Desc
Subscribe to:
Posts (Atom)