Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with indexes

Validating indexes Next Page

Rebuilding indexes


Sometimes it is necessary to rebuild an index. For example, when an index becomes skewed over time as indicated by the sa_index_density system procedure. 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 all logical indexes that share the same physical index. For more information about logical and physical indexes, see Index sharing using logical indexes.

To rebuild an index (Sybase Central)
  1. Connect to the database as a DBA user or as the owner of the table on which the index is created.

  2. In the left pane, open the Indexes folder.

  3. Select the desired index and then choose File > Rebuild.

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

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

  3. Example

    The following statement rebuilds the IX_customer_name index on the Customers table:

    ALTER INDEX IX_customer_name ON Customers REBUILD;
    See also