Re: Dealing with auto-increment in MySQL
| From: | Greg Donald | Date: | Tue, 04 Sep 2007 05:30:21 +0000 |
| Subject: | Re: Dealing with auto-increment in MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261671@lists.php.net to get a copy of this message | ||
On Mon, Sep 03, 2007 at 11:53:22PM -0400, Steve Finkelstein wrote:
> How're you folks dealing with records that are auto incremented in MySQL
> after a delete is made? I've noticed the only way to get a sequential order
> back is to truncate the table completely.
Re-numbering is a bad idea for anything more than a simple database, you risk breaking foreign keys
relations.
> Do you use logic in your code to find a missing ID and insert new records
> based on that? Or do you just ignore it, let mysql handle the numbering and
> go on with your lives?
I can't see that it matters, especially if you use unsigned ints for maximum range.
--
Greg Donald
Cyberfusion Consulting
http://cyberfusionconsulting.com/