All Products
Search
Document Center

Tablestore:Operations on tables

Last Updated:Jul 01, 2024

Tablestore SDK for Python provides various table-level features.

When you use Tablestore, you must create tables to store data. In most cases, you do not need to create secondary indexes for your data tables. You can create data tables based on your business requirements.

  • If you want to use a secondary index to improve data query efficiency, create a secondary index when you create a data table. For more information, see Create a data table.

    The secondary index feature allows you to query data based on the primary key of a data table and the index columns of the secondary index that is created for the table. This accelerates data queries.

    Note

    You can also create a secondary index after you create a data table. For more information, see Secondary index.

  • In system design scenarios that require an auto-increment primary key column, such as item IDs on e-commerce websites, user IDs on large websites, post IDs in forums, and message IDs in chat tools, you can specify an auto-increment primary key column when you create a data table. For more information, see Configure an auto-increment primary key column.

After you create data tables, you can perform specific operations on the data tables based on your business requirements. The following table describes the operations.

Operation

Description

Update a table

Updates the configuration information about a table, such as the time to live (TTL) and max versions.

Query the description of a table

Queries the configuration information about a table.

Query the names of tables

Queries the names of all tables in an instance.

Delete tables

Deletes a table.

You can also use various features when you perform operations on data in tables based on your business requirements. The following table describes the features.

Feature

Description

Scenario

Configure conditional update

If you use conditional update, data in a table can be updated only when the conditions are met. Otherwise, the update fails and an error message is returned.

This feature is suitable for scenarios in which you want to update the data of a highly concurrent application.

Configure local transaction

After you enable local transaction for a data table, you can create a local transaction based on a partition key value. You can read and write data in the local transaction and then commit or discard the local transaction based on your business requirements.

This feature is suitable for scenarios in which you want to perform atomic operations to read or write one or more rows of data.

Configure atomic counter

The atomic counter feature allows you to specify a column as an atomic counter and perform atomic counter operations on the column.

This feature is suitable for scenarios in which you want to collect real-time statistical data for online applications, such as the number of page views (PVs) on various posts.

Filter

After you configure a filter, query results are filtered on the server side based on the filter conditions. Only rows of data that meet the filter conditions are returned.

This feature is suitable for scenarios in which you want to return query results that meet specific conditions.