Updated at July 17, 2026 02:08 PM
space_object:auto_increment()
space_object
Insert a new tuple using an auto-increment primary key. The space
specified by space_object must have an
'unsigned' or 'integer' or 'number'
primary key index of type TREE. The primary-key field will be
incremented before the insert.
Since version 1.7.5 this method is deprecated – it is better to use a sequence.
Parameters:
-
space_object(space_object) — an object reference -
tuple(table/tuple) — tuple's fields, other than the primary-key field
Returns
the inserted tuple.
Return type
tuple
Complexity factors: Index size, Index type, Number of indexes accessed, WAL settings.
Possible errors:
- index has wrong type;
- primary-key indexed field is not a number.
Example:
tarantool> box.space.tester:auto_increment{'Fld#1', 'Fld#2'}---- [1, 'Fld#1', 'Fld#2']...tarantool> box.space.tester:auto_increment{'Fld#3'}---- [2, 'Fld#3']...