The solution of self-increasing ID of MySQL to reach the upper limit
What if MySQL self-adding ID runs out?
There are many types of self-increasing ID in MySQL. Each self-increasing ID sets the initial value, and then increases according to a certain step. As long as the byte length is defined, there will be an upper limit. If the upper limit is added again, a primary key conflict error will be reported, and the solution can consider using the "bigint unsigned" type.
test
The self-increasing ID defined by the datasheet, if the upper limit is reached.
When you apply for the next ID, the value you get will remain unchanged.
We can verify it with the following example:
Create table `test` (`id` int (10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=4294967295; insert into `test` values (null)
You can see from this result that the ID value was still 4294967295 when the data was first inserted.
When the data is inserted for the second time, a primary key conflict error is reported.
This means that after the ID value reaches the upper limit, it will not change again.
What if the MySQL self-adding ID runs out? For more details, please pay attention to other related articles!