MySQL Forums
Forum List  »  Replication

Re: About AUTO-INC In different mode (1,2 or 3)
Posted by: five small
Date: April 22, 2021 07:30AM

In MySQL offical:

mysql> CREATE TABLE t1 (
-> c1 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> c2 CHAR(1)
-> ) ENGINE = INNODB;
And that the most recent automatically generated sequence number is 100.

With innodb_autoinc_lock_mode set to 2 (“interleaved”), the four new rows are:

mysql> SELECT c1, c2 FROM t1 ORDER BY c2;
+-----+------+
| c1 | c2 |
+-----+------+
| 1 | a |
| x | b |
| 5 | c |
| y | d |
+-----+------+
The values of x and y are unique and larger than any previously generated rows. However, the specific values of x and y depend on the number of auto-increment values generated by concurrently executing statements.
-------------------------------------------------------------------------------

This y=x+1, right?

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: About AUTO-INC In different mode (1,2 or 3)
95
April 22, 2021 07:30AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.