Rebuild indexes

Sometimes it is necessary to rebuild an index because it has become fragmented or skewed due to extensive insertion and deletion operations on the table. When you rebuild an index, you rebuild the physical index. All logical indexes that use the physical index benefit from the rebuild operation. You do not need to perform a rebuild on logical indexes. See Index sharing using logical indexes.

You can rebuild indexes in Sybase Central, or by executing an ALTER INDEX ... REBUILD statement. You can also rebuild indexes as part of an effort to remove table fragmentation using the REORGANIZE TABLE statement. This section describes how to rebuild indexes using Sybase Central and the ALTER INDEX ... REBUILD statement. For more information about using the REORGANIZE TABLE statement, see REORGANIZE TABLE statement.

 To rebuild an index (Sybase Central)
  1. Use the SQL Anywhere 12 plug-in to connect to the database as a user with DBA authority or as the owner of the table on which the index is created.

  2. In the left pane, double-click Indexes.

  3. Right-click the index and choose Rebuild.

  4. Click OK.

 To rebuild an index (SQL)
  1. Connect to the database as a user with DBA authority, or as the owner of the table associated with the index.

  2. Execute an ALTER INDEX ... REBUILD statement.

 Example
 See also