Manual Index Optimization via ALTER INDEX

Since the full syntax of the original CREATE statement may not be known, or may be cumbersome to remember and re-enter, a Metamorph index may also be optimized with an ALTER INDEX statement:

ALTER INDEX indexName|ALL [ON tableName] OPTIMIZE|REBUILD

This will optimize the index named indexName, or all indexes in the database if ALL is given. Adding the optional ON tableName clause will limit the index(es) optimized to only those on the table named tableName. If a non-Metamorph index is specified, it will be silently ignored, as non-Metamorph indexes are always in an optimized state.

If the keyword REBUILD is given instead of OPTIMIZE, the index is rebuilt from scratch instead. This usually takes more time, as it is the same action as the initial creation of the index, and thus the whole table must be indexed, not just changes since last optimization. Any index type may be rebuilt, not just Metamorph indexes. During rebuilding, the original index is still available for search use; however inserts, deletes and updates may be postponed until the rebuild completes. Rebuilding is not generally needed, but may be useful if the index is suspected to be corrupt. The ALTER INDEX syntax was added in Texis version 7.


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.