Resetting id after deleting entries in MySQL

I’m on Chapter 7 of PHP and MySQL: Novice to Ninja and have successfully set up an admin page that allows me to delete entries in my database tables. I’ve noticed that when I delete an entry and then an add a new one that the id for the old entry is skipped and the numbering resumes after the skip or skips. For example:


Where 3 was the id of a deleted entry. Is this something that will be covered later in the book or is it even an issue to be concerned about?

I’ve never read the book, so I’m not sure if it will be covered, but this is normal behavior for auto_increment tables. The database will keep working just fine. Also, the is no way (at least, no simple way) to fill up those gaps. I wouldn’t worry about it.

And no need to worry that you’ll need those numbers because your table will get “full”, because it goes up to 2,147,483,647 (that’s for a signed int, for unsigned it even goes up to 4,294,967,295). If you’re convinced that’s not enough you can always go for unsigned bigint, which goes up to 18,446,744,073,709,551,615. But unless you’re building the next twitter or facebook, you’ll probably not going to be needing that :slight_smile:

Thank you!