Bug #34696 | auto increment gaps when using multi row insert with explicit values in InnoDB | ||
---|---|---|---|
Submitted: | 20 Feb 2008 16:27 | Modified: | 20 Feb 2008 18:14 |
Reporter: | Mattias Jonsson | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.1 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | auto_increment |
[20 Feb 2008 16:27]
Mattias Jonsson
[20 Feb 2008 16:47]
Guilhem Bichot
Could be related to BUG#31612, I don't know.
[20 Feb 2008 18:14]
Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php This is documented behavior of innodb_autoinc_lock_mode influence. See also http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html: * innodb_autoinc_lock_mode = 1 (“consecutive” lock mode) ... The exception is for “mixed-mode inserts”, where the user provides explicit values for an AUTO_INCREMENT column for some, but not all, rows in a multiple-row “simple insert.” For such inserts, InnoDB will allocate more auto-increment values than the number of rows to be inserted. However, all values automatically assigned are consecutively generated (and thus higher than) the auto-increment value generated by the most recently executed previous statement. “Excess” numbers are lost. ... * innodb_autoinc_lock_mode = 2 (“interleaved” lock mode) ... If the only statements executing are “simple inserts” where the number of rows to be inserted is known ahead of time, there will be no gaps in the numbers generated for a single statement, except for “mixed-mode inserts.