472,143 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

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 1661
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.