All Products
Search
Document Center

Tablestore:Best practices for data operations

Last Updated:Apr 03, 2025

This topic describes the best practices for data operations.

Split tables based on access frequency differences among attribute columns

If rows of a table include many attribute columns but each operation accesses only a portion of these columns, you can split the table into multiple tables. The attribute columns of different access frequencies can be placed into different tables.

For example, in a merchandise management system, each row contains attribute columns that separately specify the item quantity, item price, and item description. The data type of the attribute columns that specify the item quantity and item price is Integer that occupies a small amount of storage space. The data type of the attribute column that specifies the item description is String that occupies a large amount of storage space. Most operations only update the attribute columns that specify the item quantity and item price and do not update the attribute column that specifies the item description. Therefore, the access frequency of the attribute column that specifies the item description is relatively low. In this case, you can split the table into two tables in which the attribute columns that specify the item quantity and item price and the attribute column that specifies the item description are separately stored.

Compress text-based attribute columns

If an attribute column contains a large amount of text, the attribute columns can be compressed and stored as Binary data in Tablestore. This helps save space and reduce the consumption of computing resources, thereby reducing the cost of using Tablestore.

Store attribute columns whose data volume exceeds the upper limit in Object Storage Service (OSS)

The size of the data in an attribute column in Tablestore cannot exceed 2 MB. If you want to store more than 2 MB of data (such as pictures, music, and files) in a single attribute column, you can use OSS to store the data. Compared to Tablestore, OSS stores files at a lower unit price. Therefore, OSS is more suitable for storing objects.

If OSS cannot be used, the attribute column whose value is greater than 2 MB in size can be split into multiple smaller rows, and stored in Tablestore.

Add retry intervals

Tablestore may encounter hardware or software problems that cause some requests of the application to fail and errors for which retries can be performed are returned. If the request from an application fails and such an error is returned, we recommend that you wait a period of time before you try the request again. As a best practice, random or increased intervals are helpful to avoid an avalanche effect.