Zeradin Posted September 3, 2008 Share Posted September 3, 2008 my website involves a lot of entries in the table to be deleted. is there a way to make the id field auto_increment to save new entries as the lowest available integer rather than +1 of the last one? Thanks. Quote Link to comment Share on other sites More sharing options...
Zeradin Posted September 3, 2008 Author Share Posted September 3, 2008 MySQL client version: 4.1.22 Quote Link to comment Share on other sites More sharing options...
fenway Posted September 3, 2008 Share Posted September 3, 2008 my website involves a lot of entries in the table to be deleted. is there a way to make the id field auto_increment to save new entries as the lowest available integer rather than +1 of the last one? Thanks. There is, but there shouldn't be... it shouldn't matter to you, either, or you're using the ID field for something you're not supposed to be using it for Quote Link to comment Share on other sites More sharing options...
Zeradin Posted September 3, 2008 Author Share Posted September 3, 2008 i just figured it'd be nice and tidy having the number of ids be the number of items in my table. while i'm doing all of my testing i'm bumping the number up into the hundreds Quote Link to comment Share on other sites More sharing options...
Mchl Posted September 3, 2008 Share Posted September 3, 2008 I also had this notion when I was beginning toying with databases. But the reality is: auto_increment for database is like a grease for mechanisms. It makes the whole running smoothly, but it doesn't have to look good. By recycling auto_increment values you're likely to fall into some trouble sooner or later, without any benefits whatsoever. On the other hand, it's extremely unlikely that you will run out of 'free' numbers. Just think a second: 32bit int has maximum value of 4294967296. You'd have to do 100 inserts a second 24/7/365 to reach this number in something like 16 months... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.