Prevent InnoDB auto increment ON DUPLICATE KEY

You could set the innodb_autoinc_lock_mode config option to "0" for “traditional” auto-increment lock mode, which guarantees that all INSERT statements will assign consecutive values for AUTO_INCREMENT columns.

That said, you shouldn’t depend on the auto-increment IDs being consecutive in your application. Their purpose is to provide unique identifiers.

Leave a Comment