InnoDB + AUTO_INCREMENT questions.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Newbie questions here...

Reading the MySQL manual regarding InnoDB databases, can someone confirm
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?



Re: InnoDB + AUTO_INCREMENT questions.

Phil Latio wrote:
Quoted text here. Click to load it

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.

Quoted text here. Click to load it

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

Bill K.

Site Timeline