If you set a primary key column as an auto-increment column, you do not need to enter this column when writing data in a row. Instead, Table Store automatically generates the primary key value, which is unique in the partition key, and which increases progressively.
Table Store supports multiple primary keys. The first primary key is a partition key that cannot be set as an auto-increment column. However, one of other primary keys can be set as an auto-increment column.
Only one primary key per table can be set as an auto-increment column.
The attribute column cannot be set as an auto-increment column.
The auto-increment column can only be set at the time the table is created. The existing table cannot set the auto-increment column.
Table Store, in conjunction with the auto-increment function of an primary key column, has the following features:
The system architecture exclusive to Table Store and the implementation through an auto-increment primary key column make sure that the value generated for the auto-incrementing column is unique and strictly incrementing.
The automatically generated auto-increment column value is a 64-bit signed long integer.
The level of the partition key increases progressively.
The auto-increment function is a table level. The tables with an auto-increment column and the tables without an auto-increment column can be created in the same instance.
If the auto-increment primary key column is set, the conditional update logic is not changed. See the following table for more information.
|PutRow: The row exists.||Fail||Succeed||Fail|
|PutRow: The row does not exist.||Succeed||Fail||Fail|
|UpdateRow: The row exists.||Fail||Succeed||Fail|
|UpdateRow: The row does not exist.||Succeed||Fail||Fail|
|DeleteRow: The row exists.||Fail||Fail||Fail|
|DeleteRow: The row does not exist.||Succeed||Succeed||Fail|
Set a column as an auto-incrementing column during table creation. For more information, see Primary key column auto-increment.
After table creation, you cannot configure the auto-incrementing feature of the table.
- You cannot change the auto-increment attribute of a table by using UpdateTable.
When writing the table, you do not need to set specific values for the column that you want to set as auto-incrementing. You only need to set a placeholder, for example, AUTO_INCREMENT. For more information, see Primary key column auto-increment.
You can set ReturnType in ReturnContent as RT_PK, that is, to return the complete primary key value, which can be used in the GetRow query.
- GetRow requires a complete primary key column, which can be obtained by setting ReturnType in PutRow, UpdateRow, or BatchWriteRow as RT_PK.
The auto-increment function of primary key columns does not affect the existing billing logic. Returned data of the primary key column does not consume additional read CUs.