标签:blog http io ar sp for on 问题 log
创建表设置的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.)
标签:blog http io ar sp for on 问题 log
原文地址:http://www.cnblogs.com/huangjianan/p/4097316.html