Skip to content
Advertisement

mySql database – ID auto_increment : what are the risks of it?

I´m kind of new to databases and I was hoping you could answer my question: I have a table with an ID that´s a primary key, not null and Auto increments. It´s data type is int, with a limit of 50 digits. this table will be receiving new rows constantly, so I was wondering if it´s dangerous to leave as it is because of the digit limit and how can I override this problem. I know it might sound silly, but I´m really starting to know about databases.

Advertisement

Answer

If you’re concerned that it may hit the 50 digits (that’s a lot of rows, I would really be surprised if you reached it), you could setup a scheduled job to monitor the max Id and when close to 50 digits, then send an email to system admins about the need to clean up space or increase field size.

As far as using auto numbers the only real problem you have over time will be spaces.. How do you clean up empty data and allow the system to re-use those numbers if reaching the limit is a concern?

A secondary concern is moving records into or around in test databases. Since the number will be automatically assigned, you either have to disable the auto number or make accommodations.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement