您的位置:首页 > 博客中心 > 数据库 >

mysql的AUTO_INCREMENT失效问题

时间:2022-03-14 02:30

创建表设置的AUTO_INCREMENT属性在执行truncate操作后,自增序列会自动被置为0

 

For an InnoDB table before version 5.0.3, InnoDB processes by deleting rows one by one. As of MySQL
5.0.3, row by row deletion is used only if there are any FOREIGN KEY constraints that reference the table. If there
are no FOREIGN KEY constraints, InnoDB performs fast truncation by dropping the original
table and creating an empty one with the same definition, which is much faster
than deleting rows one by one. (When fast truncation is used, it resets any
AUTO_INCREMENT counter to zero. From MySQL 5.0.13 on,
the AUTO_INCREMENT counter is reset to zero by ,
regardless of whether there is a foreign key constraint.)

热门排行

今日推荐

热门手游