All Products
Search
Document Center

PolarDB:Overview

Last Updated:Mar 28, 2026

In MySQL, auto-increment values are local to each node. In PolarDB-X, AUTO_INCREMENT generates globally unique values across all compute nodes — a critical difference for distributed databases where multiple nodes handle inserts concurrently.

Note For background on AUTO mode and DRDS mode, see Databases in AUTO mode and DRDS mode.

How it works

When you define a column with AUTO_INCREMENT, PolarDB-X creates a sequence and links it to that column. Each time a row is inserted, the sequence generates the next globally unique value and writes it to the column.

The sequence type PolarDB-X creates depends on the partitioning mode of the database:

  • AUTO mode — NEW sequence

  • DRDS mode — GROUP sequence

To use a different sequence type, see Associate a sequence with the auto-increment column in a table.

INSERT behavior

ScenarioBehavior
No value, 0, or NULL specifiedPolarDB-X generates a globally unique value automatically
Explicit value specifiedPolarDB-X uses the specified value for the current row, then generates subsequent values greater than it

Sequence properties by database mode

The two sequence types differ in how they guarantee uniqueness, ordering, and MySQL compatibility.

PropertyNEW sequence (AUTO mode)GROUP sequence (DRDS mode)
UniquenessGlobally uniqueGlobally unique
MonotonicityGlobally monotonically increasingMonotonically increasing per compute node; not guaranteed across nodes
Value continuityConsecutive (gaps may appear after exceptions or restarts)Consecutive within a compute node connection session and within the cache duration (gaps may appear after exceptions or restarts)
MySQL compatibilityFull — all MySQL auto-increment propertiesPartial — uniqueness only; other MySQL auto-increment behaviors are not supported

What's next