Defragments clustered and secondary indexes of the specified table or view in SQL Server
Defragments clustered and secondary indexes of the specified table or view.
Syntax
DBCC INDEXDEFRAG
( { database_name | database_id | 0 }
, { table_name | table_id | 'view_name' | view_id }
, { index_name | index_id }
)
Remarks
DBCC INDEXDEFRAG can defragment clustered and nonclustered indexes on tables and views. DBCC INDEXDEFRAG defragments the leaf level of an index so that the physical order of the pages matches the left-to-right logical order of the leaf nodes, thus improving index-scanning performance.
DBCC INDEXDEFRAG is not supported for use on system tables.
ExamplesDBCC INDEXDEFRAG (Northwind, Orders, CustomersOrders)
GO