参考sys.dm_db_index_physical_stats
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/bianchengyuyan/)检查索引碎片情况
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/bianchengyuyan/)1.SELECT2.OBJECT_NAME(object_id) as objectname,3.object_id AS objectid,4.index_id AS indexid,5.partition_number AS partitionnum,6.avg_fragmentation_in_percent AS fra7.FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL , NULL, ‘LIMITED')8.WHERE avg_fragmentation_in_percent 10.0 AND index_id 0;9. 10.使用脚本中的 sys.dm_db_index_physical_stats 重新生成或重新组织索引 (