What Happens to Indexes?

A detached index on the surviving table retains its same fragmentation strategy. That is, a detached index does not automatically adjust to accommodate the new fragmentation of the surviving table. For more information on what happens to indexes, see the discussion about altering table fragments in your HCL OneDB™ Performance Guide.

In a database that supports transaction logging, an ATTACH operation extends any attached index on the surviving table according to the new fragmentation strategy of the surviving table. All rows in the consumed table are subject to these automatically adjusted indexes. For information on whether the database server completely rebuilds the index on the surviving table or reuses an index that was on the consumed table, see your HCL OneDB Performance Guide.

In a nonlogging database of HCL OneDB, an ATTACH operation does not extend indexes on the surviving table according to the new fragmentation strategy of the surviving table. To extend the fragmentation strategy of an attached index according to the new fragmentation strategy of the surviving table, you must drop the index and re-create it on the surviving table.

Some ALTER FRAGMENT ... ATTACH operations to attach a fragment can cause the database server to update the index structure. When an index is rebuilt in those cases, the associated column distribution is automatically recalculated, and is available to the query optimizer when it designs query plans for the table on which the fragment was attached.
  • For an indexed column (or a set of columns) on which ALTER FRAGMENT ... ATTACH automatically rebuilds a B-tree index, the recalculated column distribution statistics are equivalent to distributions created by the UPDATE STATISTICS statement in HIGH mode.
  • If the rebuilt index is not a B-tree index, the automatically recalculated statistics correspond to distributions created by the UPDATE STATISTICS statement in LOW mode.

See also the section Automatic Calculation of Distribution Statistics in the description of the CREATE INDEX statement for additional information about statistical distributions that are produced automatically when an index or constraint is created on an existing table.