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)
Connect to the database as a user with DBA authority, or as the owner of the table on which the index is created.
In the left pane, double-click Indexes.
Right-click the index and choose Rebuild.
To rebuild an index (SQL)
Connect to the database as a user with DBA authority, or as the owner of the table associated with the index.
Execute an ALTER INDEX ... REBUILD statement.
The following statement rebuilds the IX_customer_name index on the Customers table:
ALTER INDEX IX_customer_name ON Customers REBUILD;
For more information about index fragmentation and skew, and how to reduce them, see Reducing index fragmentation and skew.
For more information about the syntax for the ALTER INDEX statement, see ALTER INDEX statement.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|