Search code examples
mysqldebiangaleramariasqlmariadb-10.5

auto_increment jumps by 3 and not 1


I have noticed that in my mysql server, the auto_increment setting increments by 3, for example 3 6 9 12 15 etc.

All the tables in the database are having the same problem.

I'm using mariadb 10.5 on debian 10.

Could it be because of having a 3 vps galley cluster?

MariaDB [(none)]> SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| auto_increment_increment | 3     |
| auto_increment_offset    | 1     |
+--------------------------+-------+
2 rows in set (0.002 sec)

Solution

  • They designed it to be like that. You could say that it is a limitation of using Galera. They made it like that to address the collision issue when generating sequential numbers as primary key during inserts in a Multi-Master cluster.

    https://mariadb.org/auto-increments-in-galera/