No,
idxbuild and
idxactivate do not create the same physical index key result.
IDXBUILD is an offline utility.
- Index entries are literally rebuilt from scratch, by reading and sorting key fields before inserting them into an index to get perfect B-Tree order then re-activates the associated Storage Object.
- The structure of the database changes during IDXBUILD.
- This process does not log any recovery notes (BI or AI) during its operation, which is why:
- It is important to have a full verified backup before running an idxbuild
- It requires After-imaging to be disabled. Any after image files would not apply to the database due to the time stamp change when the IDXBUILD runs against the database.
IDXACTIVATE can be run online or offline.
- While multiple idxactivate commands can be run at the same time online against different tables, only one index can be activated at a time.
- If multiple indexes are being activated with IDXACTIVATE in separate command lines, a schema timestamp check will follow for each activation to ensure that there are no users (including another IDXACTIVATE session) with a schema timestamp that is earlier than the schema timestamp of the index being built. If any such users are connected to the database, IDXACTIVATE cannot proceed until their timestamps are refreshed.
- Idxactivate scans the table following the specified "useindex" and inserts index entries in the order they are found, there is no sorting.
- The number of records scanned can be scoped with the -recs parameter to limit the transaction scope. Even if the -recs value equates to the entire table, the resulting index will not be sorted the same as an idxbuild. Key entries are not built, sorted and then inserted in one transaction as is the the case with an index rebuild.
Another option is to use PROUTIL -C TABLEMOVE and move the indexes at the same time.
- When records are moved to a new area, their recid changes.
- The key entries therefore need to be rebuilt in the new index area, where sorting will be in the order of the index used
- Alternatively, an IDXMOVE to a new area followed by an online IDXCOMPACT