打印本文 打印本文 关闭窗口 关闭窗口
重建 SQLServer 索引的重要性!
作者:武汉SEO闵涛  文章来源:敏韬网  点击数8609  更新时间:2007/11/14 13:07:47  文章录入:mintao  责任编辑:mintao
Avg. Bytes Free per Page                  扫描页面中平均自由字节数

 

Avg. Page Density (full)                     平均页密度,表示页有多满

 

从上面命令的执行结果可以看的出来,Best count为3 而Actual Count为5这表明orders表有分块需要重构表索引。下面通过DBCC DBREINDEX来重构表的簇索引。

 

同样在Query Analyzer中输入命令:

use northwind

dbcc dbreindex(''''northwind.dbo.orders'''',pk_orders,90)

执行结果

DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Dbcc dbreindex参数说明第一个参数为要重构的表明。第二个参数为需要重构的索引表识,‘’表示所有的索引。第三个参数为页的填充因子,填充因子越大,页越满。

然后再用DBCC SHOWCONTIG查看重构簇索引后的结果:

use northwind

declare @table_id int

t @table_id=object_id(''''orders'''')

dbcc showcontig(@table_id)

返回结果如下:

DBCC SHOWCONTIG scanning ''''Orders'''' table...

Table: ''''Orders'''' (21575115); index ID: 1, database ID: 6

TABLE level scan performed.

- Pages Scanned................................: 22

-

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9]  下一页

打印本文 打印本文 关闭窗口 关闭窗口