Stop MySQL Reusing AUTO_INCREMENT IDs

后端 未结 5 1647
闹比i
闹比i 2020-12-07 01:40

I have a table with an AUTO_INCREMENT primary key. If the last row in the table is deleted, the next-inserted row will take the same ID.

Is there a way of getting My

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 02:07

    Mysql manual says:

    In this case (when the AUTO_INCREMENT column is part of a multiple-column index), AUTO_INCREMENT values are reused if you delete the row with the biggest AUTO_INCREMENT value in any group. This happens even for MyISAM tables, for which AUTO_INCREMENT values normally are not reused.

    It seems there is such a behavior possible for the engines, other than MyISAM

提交回复
热议问题