469,610 Members | 1,649 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

InnoDB + AUTO_INCREMENT questions.

Newbie questions here...

Reading the MySQL manual regarding InnoDB databases, can someone confirm
that:
1. if the server is rebooted, AUTO_INCREMENT reverts back to 1?
2. what happens if the field is specified as or PRIMARY KEY or UNIQUE?

Cheers

Phil

Apr 25 '06 #1
1 1583
Phil Latio wrote:
Newbie questions here...

Reading the MySQL manual regarding InnoDB databases, can someone confirm
that:
1. if the server is rebooted, AUTO_INCREMENT reverts back to 1?
False. The next row inserted into a table with an AUTO_INCREMENT column
generates a new value, the next in the sequence higher than the last
value that was generated for that column. Note that this could leave
gaps, if you have deleted rows in the meantime.

The database remembers which value was last generated per table, even
after a reboot.
2. what happens if the field is specified as or PRIMARY KEY or UNIQUE?


No difference.

Note that AUTO_INCREMENT can be declared only for an indexed integer
column, of which columns with PRIMARY KEY or UNIQUE constraints are
examples.

Regards,
Bill K.
Apr 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Kurt Tragant | last post: by
reply views Thread by Mike Chirico | last post: by
3 posts views Thread by Jeremy Howard | last post: by
2 posts views Thread by Morten | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.