Database auto-increment primary keys run out what will happen?

In mysql, suppose we define the primary key is intunsigned, it can be up to a power of 32 - 2 1 = 4294967295, which we will AUTO_INCREMENT set to the maximum, then an exception will be inserted into the data

insert into t1 values(null) Error Code: 1062. Duplicate entry '4294967295' for key 'PRIMARY'

Mainly because when we insert data, because the primary key is the maximum, so the data is inserted again when, to get data or 4294967295 and since this data already exists in the database, so the primary key violation will be reported error .

Guess you like

Origin www.cnblogs.com/fiany/p/11532562.html