This topic describes the operations that you can perform on tables by using Tablestore SDK for Java.
When you use Tablestore, you must create tables for data storage. In most cases, you do not need to configure secondary indexes for your tables. You can create tables that have the following features based on your business requirements:
If you want to use a secondary index to improve data query efficiency, configure a secondary index when you create a table. For more information, see Create a data table.
The secondary index feature allows you to create one or more index tables for a table. Then, you can query data based on the primary key columns of the index tables instead of the table.
If you want to perform atomic operations to read or write one or more rows of data, enable the local transaction feature when you create a table. For more information, see Create a data table.
If you want to use an auto-increment primary key column for data such as product IDs, user IDs, post IDs, and message IDs, configure an auto-increment primary key column when you create a table. For more information, see Configure an auto-increment primary key column.
If you want to encrypt a table when the table is saved to a disk, configure table encryption when you create a table. For more information, see Create an encrypted table.
After you create tables, you can perform the following operations on the tables based on your business requirements.
Operation | Description |
Updates the configurations of a table, such as the time to live (TTL) and max versions of data. | |
Queries the configurations of a table. | |
Queries the names of all tables in an instance. | |
Adds predefined columns to or removes predefined columns from a table. When you create a secondary index for a table, you can set the predefined columns of the table as the index columns or attribute columns of the secondary index. | |
Deletes a table. |
You can also use the following features when you perform operations on data in tables based on your business requirements.
Feature | Description | Scenario |
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 updating data in high-concurrency scenarios. | |
After you enable local transaction for a table, you can create a local transaction based on a partition key value. After you read or write data within a local transaction, you can commit or abort the local transaction. | This feature is suitable for performing atomic operations to read or write one or more rows of data. | |
Atomic counters allow you to implement an atomic counter on a column. | This feature is suitable for obtaining statistical data for online applications, such as the number of page views (PVs) on various posts. | |
After you configure a filter, query results are filtered on the server side based on the filter conditions. Only rows of data that match the filter conditions are returned. | This feature is suitable for querying data that meets specific conditions. | |
You can split data in a table into logical shards whose sizes are approximately the specified value. The information about the split points among the shards and the machines on which the shards reside is returned. | This feature is suitable for implementing concurrency plans on compute engines. |