Programming in MS SQL Server 2012

Reorganize Indexes



Reorganizing an index is always executed online. Reorganizing an index uses minimal system resources. It defragments the leaf level of clustered and nonclustered indexes on tables and views by physically reordering the leaf-level pages to match the logical, left to right, order of the leaf nodes. Reorganizing also compacts the index pages. Compaction is based on the existing fill factor value.

The following example describes to reorganize the IX_Employee_Nonclustered index on the dbo.Employee table.

-- Example 156 --

 

USE EBusiness

GO

 

ALTER INDEX IX_Employee_Nonclustered ON dbo.Employee

REORGANIZE

GO


Query Output Screen



The following example describes to reorganize ALL indexes on dbo.Employee table.

-- Example 157 --

 

USE EBusiness      

GO

 

ALTER INDEX ALL ON dbo.Employee

REORGANIZE

GO


Query Output Screen



* * * * *


Email Your Comment To AUTHOR