GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   MySQL question (https://gfy.com/showthread.php?t=747693)

biskoppen 07-01-2007 05:36 PM

MySQL question
 
Let's say I have a table with an auto_increment field called "id"..

This table got 5 rows.. where "id" goes from 1-5..

Now I delete row 4 and 5..

The next row I insert will get "id" = 6...

How do I get it do let the next "id" to start at 4 which is the highest available number?

(Don't ask why I need that :) )

budz 07-01-2007 05:38 PM

I use navicat.. you can edit anything in your table manually.

but I'd like to know how to automate this because that is annoying when you delete records :)

Donkey Punch 07-01-2007 05:51 PM

Quote:

INNODB tables store the auto increment id in the MYI file. Even if you delete rows and restart the server MySQL will not reuse the id. The same is true for innodb.
from gooooogle serps

k0nr4d 07-01-2007 05:55 PM

i think 'OPTIMIZE' does that. google it, im not positive

biskoppen 07-01-2007 05:57 PM

Quote:

Originally Posted by k0nr4d (Post 12688617)
i think 'OPTIMIZE' does that. google it, im not positive

Hmm... actually think I heard about that some years ago... will investigate that

Alky 07-01-2007 06:03 PM

why even use the auto increment feature then? just use your own id #'s

biskoppen 07-01-2007 06:15 PM

Quote:

Originally Posted by Alky (Post 12688650)
why even use the auto increment feature then? just use your own id #'s

Yeah, that was mine conclusion too... changing it right now.. (Thanks though)


All times are GMT -7. The time now is 07:55 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123