All Products
Search
Document Center

Tablestore:How do I delete multiple rows of data at the same time?

Last Updated:Mar 07, 2025

After you obtain the primary key information of the data you want to delete, you can call the BatchWriteRow operation to delete the data.

Tablestore allows you to use primary key information to delete multiple rows of data. You can perform the following steps to delete multiple rows of data at the same time:

  1. Select a suitable method based on your business requirements to query the primary key information of the data that you want to delete.

    • To delete the data whose primary key values are in the specified range, call the GetRange operation to query the data and obtain the primary key information of the data. For more information, see Read data.

    • To delete data that meets specific conditions from a data table for which a search index is created, use the search index to query the data and obtain the primary key information of the data. For more information, see Basic query.

    • To delete all data from a data table, we recommend that you delete the data table and create a data table that has the same configurations.

      You can also call the GetRange operation and set the start primary key to INF_MIN and the end primary key to INF_MAX to scan all data in the table. This way, you can obtain the primary key information of all data in the table. However, this consumes a large amount of computing resources. Proceed with caution.

  2. Call the BatchWriteRow operation to delete multiple rows of data at the same time based on the primary key information of the rows. For more information, see Write data.