Difference with MySQL
auto-increment ID in EloqSQL
-
In the eloq engine, all manual input of auto-increment will be ignored. For example, the following SQL statement is used to create a table named
t1
, The table consists of two columns,i
andj
, wherei
is the primary key, an integer type, and is set to auto-increment.j
is also an integer type.create table t1(i int primary key auto_increment, j int)engine=eloq;
- Case 1
insert into t1 values(null, 1);
- Case 2
insert into t1 values(1, 1);
- Case 3
insert into t1(j) values(1);
Cases 1-3 produce the same result, the input for field
i
will be ignored. -
When each node inserts the table record for the first time after startup, it will apply for a range of
id
for the node's record insertion. Each node applies separately, and the result is only used for this node, so the auto-increment field cannot guarantee that theid
is strictly incremented, only that it is not repeated. When theid
of the range is used in this node, it will apply again. If the node is closed halfway, the unusedid
will be discarded. -
You can modify the id range of the table with the following statement:
set global eloq_auto_increment="table_name=t1;offset=10000;increment=15;range=1024";
table_name
: table nameoffset
: the initial value of the auto-increment idincrement
: the interval between getting id twicerange
: the range in which the node obtains the id at one time