You can modify a partial index on the partitioned table: add, rebuild, and delete a secondary index on partitions.
Syntax
Add a partial index on partitions.
ALTER TABLE table_name ALTET INDEX index_name ADD PARTITION partition_name0[, ...];
Rebuild a partial index on partitions.
ALTER TABLE table_name ALTET INDEX index_name REBUILD PARTITION partition_name0[, ...];
Delete a partial index on partitions.
ALTER TABLE table_name ALTET INDEX index_name DROP PARTITION partition_name0[, ...];
Parameters
Parameter | Description |
table_name | The name of the partitioned table. |
index_name | The name of the index. |
partition_name0 | The name of the partition or subpartition. Note You can specify multiple partitions or subpartitions. Separate multiple partitions or subpartition names with commas (,). |
Examples
Modify a partial index on a partition.
Add a partial index named
o_ind_amou
on theorders_202212
partition of theorders
partitioned table.ALTER TABLE orders ALTER INDEX o_ind_amou ADD PARTITION orders_202212;
Rebuild the
o_ind_amou
partial index on theorders_202203
,orders_202204
, andorders_202205
partitions of theorders
partitioned table.ALTER TABLE orders ALTER INDEX o_ind_amou REBUILD PARTITION orders_202203, orders_202204, orders_202205;
Delete the
o_ind_amou
partial index from theorders_202201
andorders_202202
partitions of theorders
partitioned table.ALTER TABLE orders ALTER INDEX o_ind_amou DROP PARTITION orders_202201, orders_202202;
Modify a partial index on a subpartition.
Add a partial index named
ind_date
on thep0_3
andp0_4
subpartitions in thetenants
partitioned table.ALTER TABLE tenants ALTER INDEX ind_date ADD partition p0_3, p0_4;
Rebuild the
ind_date
partial index on thep0_1
andp1_1
subpartitions intenants
partitioned table.ALTER TABLE tenants ALTER INDEX ind_date REBUILD PARTITION p0_1,p1_1;
Delete the
ind_date
partial index from thep1_1
subpartition in thetenants
partitioned table.ALTER TABLE tenants ALTER INDEX ind_date DROP PARTITION p1_1;