All Products
Search
Document Center

Tablestore:Delete a secondary index

Last Updated:Mar 15, 2024

If you no longer need a secondary index that is created for a data table, you can call the DeleteIndex operation to delete the secondary index.

Prerequisites

Usage notes

Deleted secondary indexes cannot be restored. If you need to use the secondary index after you delete it, you need to create the secondary index again.

Parameters

Parameter

Description

mainTableName

The name of the data table.

indexName

The name of the secondary index.

Examples

The following sample code provides an example on how to delete a secondary index.

private static void deleteIndex(SyncClient client) {
    // Specify the names of the data table and the secondary index. 
    DeleteIndexRequest request = new DeleteIndexRequest("<TABLE_NAME>", "<INDEX_NAME>"); 
    // Delete the secondary index. 
    client.deleteIndex(request); 
}