# Mysql 'Interleaved' auto increment lock mode still running my concurrent statements sequentially

**URL:** <https://forums.percona.com/t/mysql-interleaved-auto-increment-lock-mode-still-running-my-concurrent-statements-sequentially/11956>\
**Category:** MySQL & MariaDB\
**Created:** [August 27, 2021, 10:12pm UTC](https://forums.percona.com/t/mysql-interleaved-auto-increment-lock-mode-still-running-my-concurrent-statements-sequentially/11956 "2021-08-27T22:12:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![clinto](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@clinto](https://forums.percona.com/u/clinto)\
**Post date:** [August 27, 2021, 10:12pm UTC](https://forums.percona.com/t/mysql-interleaved-auto-increment-lock-mode-still-running-my-concurrent-statements-sequentially/11956/1 "2021-08-27T22:12:38Z")

</div>

Hi,

I was hoping to improve the speed and concurrency of our system by enabling the ‘Interleaved’ mode on auto increment locks as explained here: [AUTO\_INCREMENT Handling in InnoDB - MariaDB Knowledge Base](https://mariadb.com/kb/en/auto_increment-handling-in-innodb/#auto_increment-lock-modes).

I ran a test before and after enabling the mode by running several concurrent inserts into a table with an auto-increment id. Each statement inserted 50,000 records using a multi-line insert statement. (Explained here, for example: [MySQL Insert Multiple Rows By Practical Examples](https://www.mysqltutorial.org/mysql-insert-multiple-rows/)).

I’m getting the same results regardless of changing to ‘interleaved’ mode. If I run a single insert, it takes about 20 seconds. Running 3 inserts concurrently appears to cause them all to run consecutively and it takes about 60 seconds to finish (though it does seem like all three statements finish about around the same time). The auto-increment values are consecutive by each statement, not interleaved.

Shouldn’t these be running concurrently? I was expecting to get near 20 second runtimes even when running 3 concurrent statements. Is there some other table level lock in play here that I’m not aware of?

I tried both with and without a duplicate key update as part of the statement and got the same results.

---

<div class="post-metadata">

**Author:** ![clinto](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@clinto](https://forums.percona.com/u/clinto)\
**Post date:** [August 30, 2021, 4:52pm UTC](https://forums.percona.com/t/mysql-interleaved-auto-increment-lock-mode-still-running-my-concurrent-statements-sequentially/11956/2 "2021-08-30T16:52:30Z")

</div>

I ran another test using an identical table except that it did NOT have an auto-increment ID, and I’m getting similar runtimes.

It appears that inserts of this form lock the table regardless of whether there’s an auto-increment ID. If anyone has any knowledge of whether it is possible to run inserts concurrently, I’d love to hear from you.
