mysql auto_increment holes

admin

Administrator
Staff member
Is there an easy way to get auto_increment to fill in gaps, rather than just doing 1+maxValue?

I've got tables set up with auto_increment fields. But as I delete rows, auto_increment only sets a new entry to 1+maxValue. So if I delete the row with auto_increment value 2, 2 is gone for good and will never get used again.

I haven't seen any discussion about this - is auto_increment set this way for a reason? Is it bad form to try and reuse deleted auto_increment values?
 
Back
Top