Dela via


How to: Rebuild an Index (SQL Server Management Studio)

This topic describes how to rebuild an index or all indexes on a table by using Object Explorer in SQL Server Management Studio. Rebuilding an index drops and re-creates the index. This removes fragmentation, reclaims disk space by compacting the pages based on the existing fill factor setting, and reorders the index rows in contiguous pages. For more information about index fragmentation, see Reorganizing and Rebuilding Indexes.

To rebuild an index

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.

  2. Expand Databases, expand the database that contains the table with the specified index, and then expand Tables.

  3. Expand the table in which the index belongs and then expand Indexes.

  4. Right-click the index to rebuild and then click Rebuild.

  5. To start the rebuild operation, click OK.

To rebuild all indexes on a table

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.

  2. Expand Databases, expand the database that contains the table with the specified indexes, and then expand Tables.

  3. Expand the table in which the indexes belong.

  4. Right-click Indexes and then click Rebuild All.

  5. To start the rebuild operation, click OK.