日期:2014-05-18  浏览次数:20477 次

怎么查看索引碎片??
怎么查看索引碎片??

------解决方案--------------------
DBCC CHECKTABLE
------解决方案--------------------
A. 检查特定表
下例检查 authors 表的数据页完整性。

DBCC CHECKTABLE ('authors')
GO

B. 检查表,但不检查非聚集索引
下例对 authors 表的数据页完整性进行检查,但不检查非聚集索引。

DBCC CHECKTABLE ('authors') WITH PHYSICAL_ONLY
GO

C. 检查特定索引
下例对通过访问 sysindexes 获得的特定索引进行检查。

USE pubs
DECLARE @indid int
SELECT @indid = indid 
FROM sysindexes
WHERE id = OBJECT_ID('authors') AND name = 'aunmind'
DBCC CHECKTABLE ('authors', @indid)
GO


------解决方案--------------------
SQL code
dbcc showcontig('表名')

------解决方案--------------------
sys.dm_db_index_physical_stats
------解决方案--------------------
SQL code
 select sys.dm_db_index_physical_stats as '统计碎片'