[thelist] Auto Increment in database

Jay Blanchard jay.blanchard at niicommunications.com
Thu Apr 18 09:45:01 CDT 2002


[snip]
I'd be interested to hear your suggestions, the only way I've ever done it
was to drop the database (since auto_increment indexes are handled
internally by mysql)
[/snip]

I tried...

ALTER TABLE tbl_name AUTO_INCREMENT = 1;
(http://www.mysql.com/doc/e/x/example-AUTO_INCREMENT.html)
which did not work.

then...
Internal handling of one AUTO_INCREMENT column. MyISAM will automatically
update this on INSERT/UPDATE. The AUTO_INCREMENT value can be reset with
myisamchk. This will make AUTO_INCREMENT columns faster (at least 10 %) and
old numbers will not be reused as with the old ISAM. Note that when an
AUTO_INCREMENT is defined on the end of a multi-part-key the old behavior is
still present. (http://www.mysql.com/doc/M/y/MyISAM.html)

from the command line myisamchk --set-auto-increment=1 tbl_name.MYI
which also did not work

The option offered by Anthony Baratta, "With MS SQL, I've just dropped the
ID Field saved the changes, then added
the ID Field back in."
...worked...and does save time...especially over dropping the whole shebang

Jay





More information about the thelist mailing list