Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql table running out of ids

Tags:

mysql

innodb

We have a mysql table that is running out of ids soon (the primary id is a 32-bit integer and the max id is already about 1.5 billion). What is the best way to fix this issue? Alter the id type to 64-bit is an option but that would bring down the database for too long because the table has billion of rows.

like image 223
Pinch Avatar asked Jan 23 '16 01:01

Pinch


2 Answers

All versions of MYSQL (both 32bit and 64bit) use an 8 byte field for a column defined as BIGINT.

So amend the column to be BIGINT

Check the documentation

like image 129
RiggsFolly Avatar answered Dec 09 '22 12:12

RiggsFolly


then try changing the type of the field. Try some type with a big range like "BIGINT".

like image 44
Iresha Rubasinghe Avatar answered Dec 09 '22 13:12

Iresha Rubasinghe