All Products
Search
Document Center

Tablestore:Delete a secondary index

Last Updated:Apr 30, 2026

Call the DeleteIndex operation to delete a secondary index from a data table. Once deleted, the index cannot be restored.

Prerequisites

Usage notes

Deleted secondary indexes cannot be restored. To use the index again, recreate it.

Parameters

Parameter

Description

mainTableName

The name of the data table.

indexName

The name of the index table.

Examples

The following sample code deletes two global secondary indexes from a data table in a single call:

public static void DeleteGlobalIndex()
{
    OTSClient otsClient = Config.GetClient();

    Console.WriteLine("Start delete globalIndex...");

    DeleteGlobalIndexRequest request = new DeleteGlobalIndexRequest(TableName, IndexName);
    otsClient.DeleteGlobalIndex(request);

    DeleteGlobalIndexRequest request2 = new DeleteGlobalIndexRequest(TableName, IndexName2);
    otsClient.DeleteGlobalIndex(request2);

    Console.WriteLine("Global Index is deleted,tableName: " + TableName + ",IndexName:" + IndexName + "," + IndexName2);

}