[EMAIL PROTECTED] wrote:
 This is from the docs ..... "The auto-increment value of a deleted
 record will only not be reused until the server is restarted, then it
 will be reused. In other words, if you insert 10 rows into an InnoDB
 table and then delete them the AUTO_INCREMENT value will stay at 11
 until the server is shutdown at which point it will revert to 1!!!""

Now if i have records 1 to 10 and i delete some records in between, say,
5, 7, 8. Now when i restart my server, will these values of 5, 7 and 8 be
reused??

No.

Does it mean that the autoincrement values of deleted records will be
reused only if ALL records are deleted and then server restarted??

No.

From docs .... "  Note that you may see gaps in the sequence of values
assigned to the AUTO_INCREMENT column if you roll back transactions that
have gotten numbers from the counter. " Does InnoDB reuse these gap values at any time ???

No.

Thanks Priya

There is no special handling of gaps. At startup, the next auto_increment value is simply set to MAX(auto_increment_col) + 1. Thus, values at the end which are deleted will be reused, but gaps remain. For example, if you have records 1 to 10, delete records 3, 6, 9, and 10, then restart, the next value will be 9. See the manual for details <http://dev.mysql.com/doc/mysql/en/innodb-auto-increment-column.html>.

Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to