All Products
Search
Document Center

Tablestore:Conditional updates

Last Updated:Aug 22, 2025

Tablestore supports conditional updates, which allow you to update data in a target row only if the row meets a specified condition.

Function overview

Conditional updates allow you to implement mechanisms similar to the SQL WHERE clause or optimistic locking. In Tablestore, conditional updates can be based on row existence or column values.

Row existence condition

This condition checks whether a target row exists in the data table. The following three conditions are supported:

  • Ignore: The existence of the row is not checked.

  • Expect existence: The condition is met if the target row exists in the data table.

  • Expect non-existence: The condition is met if the target row does not exist in the data table.

Column value condition

This condition checks whether the value of an attribute column in the target row meets a specified condition. The following two types of conditions are supported.

Type

Supported operations

Description

Single-value condition

Relational operations: equal to, not equal to, greater than, greater than or equal to, less than, and less than or equal to

  • Checks whether the value of a single attribute column meets the condition.

  • Specify whether the condition is met if the target attribute column does not exist in the row. By default, the condition is considered met.

  • Specify the data version of the attribute column for the check. You can check only the latest version or all versions. By default, only the latest version is checked.

Composite condition

Logical operations: NOT, AND, and OR

  • Checks whether the row data meets the composite condition.

  • The sub-conditions of a composite condition can be a single-value condition or another composite condition.

  • A combination of up to 32 conditions is supported.

Usage

Conditional updates can be performed only using an SDK or the command line interface (CLI).

Billing

When you use conditional updates to check for row existence and column values, the target row data is read. This operation incurs data read fees. The fees are calculated in the same way as for standard data reads. For more information, see Billing overview.