首页 > 数据库技术 > 详细

mysql的AUTO_INCREMENT失效问题

时间:2014-11-14 15:32:48      阅读:678      评论:0      收藏:0      [点我收藏+]

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

 

http://dev.mysql.com/doc/refman/5.0/en/truncate-table.html

For an InnoDB table before version 5.0.3, InnoDB processes TRUNCATE TABLE 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 TRUNCATE TABLE,
regardless of whether there is a foreign key constraint.)

mysql的AUTO_INCREMENT失效问题

原文:http://www.cnblogs.com/huangjianan/p/4097316.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!