查看数据表的内外碎片情况
View Code
use DBName go select page_count,avg_page_space_used_in_percent, record_count,avg_record_size_in_bytes,avg_fragmentation_in_percent, fragment_count from sys.dm_db_index_physical_stats (DB_ID('DBName'),OBJECT_ID('TableName'),NULL,NULL,'sampled') DBCC ShowContig(TableName)
查看索引的碎片情况
dbcc showcontig('tableName','IndexName')
参考
http://www.cnblogs.com/petitprince/archive/2009/10/23/1588603.html