mysql的AUTO_INCREMENT失效问题
创建表设置的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.)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。