学院首页>网络编程>SQL Server>维护Sql Server中表的索引

维护Sql Server中表的索引

作者: 来源: 添加时间:2006-5-22 11:14:10

--第一步:查看是否需要维护,查看扫描密度/Scan Density是否为100%
declare @table_id int
set @table_id=object_id('表名')
dbcc showcontig(@table_id)

--第二步:重构表索引
dbcc dbreindex('表名',pk_索引名,100)

--重做第一步,如发现扫描密度/Scan Density还是小于100%则重构表的所有索引
--杨铮:并不一定能达100%。
dbcc dbreindex('表名','',100)

站内搜索