ALTER INDEX statement
The ALTER INDEX statement defines changes to an index.
ALTER INDEX indexOwner 1 .indexName 1 | This option specifies the fully qualified name of the index to be changed. | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
OWNER indexOwner 2 | This option specifies the new owner of the index. | ||||||||||
NAME indexName 2 | This option specifies the new name of the index. | ||||||||||
TABLE tableOwner.tableName | This option specifies the table on which the index is created. If the only change to the index is the table name that it references, BMC AMI Change Manager for Db2 does not generate CDL. If you change the index to reference a different table, Change Manager generates DROP INDEX and CREATE INDEX CDL statements. | ||||||||||
KEYCOLUMNS (columnName order, ...) | This option specifies the column list that defines the key for this index. The following table lists valid values for the order variable in the KEYCOLUMNS parameter. Order values for the KEYCOLUMNS parameter
| ||||||||||
KEYTEXT (expression) | This option specifies the parts of the XML documents in an XML column that are indexed (XMLPATTERN). | ||||||||||
XMLdataType | For an XML index, this option specifies the SQL data type. The XMLdataType can be one of the following types:
| ||||||||||
PERIOD BUSINESS_TIME | This option indicates whether to add starting and ending columns of the BUSINESS_TIME period to the index. The starting and ending columns are defined in the table on which the index is created.parameter. PERIOD BUSINESS_TIME parameter values
| ||||||||||
UNIQUE | This option indicates whether index values must be unique. UNIQUE parameter values
| ||||||||||
DSSIZE integer G | This option specifies the maximum size for each index partition in gigabytes. | ||||||||||
COMMENT 'string' | This option specifies the comment for the index. | ||||||||||
NOCOMMENT | This option removes the comment for the index. | ||||||||||
NUMPARTS number | This option specifies the new number of partitions for the index. NUMPARTS=0 specifies a nonpartitioned index. | ||||||||||
ALTER PART partitionNumber indexPartitionParameters | For a partitioned index, this option alters partitionNumber according to the parameters of indexPartitionParameters (see indexPartitionParameters). To alter parameters for a nonpartitioned index, the partitionNumber value must be zero. For example, the following example changes the value for the PCTFREE attribute for a nonpartitioned index to 20. ALTER INDEX ... ALTER PART 0 PCTFREE 20 | ||||||||||
ADD PART BEFORE partitionNumber indexPartitionParameters | For a partitioned index, this option adds a new partitionNumber according to the parameters of indexPartitionParameters (see indexPartitionParameters). | ||||||||||
ADD PART AFTER partitionNumber indexPartitionParameters | For a partitioned index,this option adds a new partitionNumber according to the parameters of indexPartitionParameters (see indexPartitionParameters). | ||||||||||
DROP PART number | For a partitioned index, this option drops the specified partition. | ||||||||||
indexOptions | This option provides additional options for indexes (see indexOptions). |
indexPartitionParameters
indexPartitionParameters includes the following parameters.
VCAT catalogName | This option specifies the volume catalog to be used for the index. | ||||||||
---|---|---|---|---|---|---|---|---|---|
STOGROUP | This option specifies the new default storage group for the index. STOGROUP parameter values
| ||||||||
PRIQTY number | This option specifies the primary space that is allocated for the Db2 defined data set. | ||||||||
SECQTY number | This option specifies the secondary space that is allocated for the Db2 defined data set. | ||||||||
ERASE | This option indicates whether to erase the data sets when they are deleted by a statement that drops the index. ERASE parameter values
| ||||||||
FREEPAGE number | This option specifies that a free page is added after every number of pages upon index creation or reorganization. | ||||||||
PCTFREE number | This option specifies the percentage of free space left on each page of the index upon creation or reorganization. | ||||||||
GBPCACHE | This option specifies which index pages are cached to the group buffer pool. The following table lists valid values for the GBPCACHE parameter. TGBPCACHE parameter values
| ||||||||
DSSIZE integer G | This option specifies the maximum size for the index partition in gigabytes. | ||||||||
VALUES (constant, ...) | This option specifies the replacement key limit list for this part of a partitioned index. |
indexOptions
indexOptions includes the following parameters.
CLUSTER | This option indicates whether the index is defined as a clustering index. CLUSTER parameter values
| ||||||||
---|---|---|---|---|---|---|---|---|---|
PADDED | This option indicates how columns that are defined as VARCHAR are stored in the index. PADDED parameter values
| ||||||||
COMPRESS | This option indicates whether index data is compressed. COMPRESS parameter values
| ||||||||
DEFINE | This option specifies when the data sets for the index are created. DEFINE parameter values
| ||||||||
PARTITIONED | This option indicates whether the index is partitioned. PARTITIONED parameter values
| ||||||||
BUFFERPOOL | This option specifies the new default buffer pool for the index. BUFFERPOOL parameter values
| ||||||||
CLOSE | This option indicates whether the index can be closed when the index is not being used. CLOSE parameter values
| ||||||||
PIECESIZE integer keyword | This option specifies the maximum PIECESIZE for a nonpartitioned index. The default PIECESIZE is 2 G (2 GB) for indexes backed by non-LARGE table spaces and 4 G (4 GB) for indexes backed by LARGE table spaces. The subsequent keyword (K, G, or M) indicates the value of the specific integer. PIECESIZE keyword values
| ||||||||
COPY | This option indicates whether to use a utility to create an image copy of the index. COPY parameter values
|
Related topic