How to check fragmentation on SQL Server 2005

SELECT object_id, index_id, avg_fragmentation_in_percent, page_count 
FROM sys.dm_db_index_physical_stats(DB_ID('your_db_name'), OBJECT_ID('your_one_table'), NULL, NULL, NULL);
 
Reference Values (in %) Action SQL statement

avg_fragmentation_in_percent > 5 AND < 30

Reorganize Index ALTER INDEX REORGANIZE

avg_fragmentation_in_percent > 30

Rebuild Index ALTER INDEX REBUILD

 

 

posted on 2012-08-30 22:32  |残阳|露  阅读(213)  评论(0编辑  收藏  举报

导航