My Oracle Support Banner

How is the Next Value for an Auto-Increment Id Determined in MySQL? (Doc ID 1352943.1)

Last updated on JULY 19, 2018

Applies to:

MySQL Server - Version 5.0 and later
Information in this document applies to any platform.

Goal

Learn how MySQL determines the next value for an auto-increment column and which options can be used to control the behavior.

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution
 Auto-Increment Assignment
 The innodb_autoinc_lock_mode Option
 innodb_autoinc_lock_mode = 0 ("Traditional" Lock Mode)
 innodb_autoinc_lock_mode = 1 ("Consecutive" Lock Mode)
 innodb_autoinc_lock_mode = 2 ("Interleaved" Lock Mode)
 Implications of innodb_autoinc_lock_mode
 Using Auto-Increment With Replication
 "Lost" Auto-Increment Values and Sequence Gaps
 Gaps in Auto-Increment Values for "Bulk Inserts"
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.