Bug #91906 | ALTER TABLE AUTO_INCREMENT is not as good as expected | ||
---|---|---|---|
Submitted: | 6 Aug 2018 8:19 | Modified: | 6 Aug 2018 10:52 |
Reporter: | Jan jan | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: Storage Engines | Severity: | S5 (Performance) |
Version: | 5.6.20 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[6 Aug 2018 8:19]
Jan jan
[6 Aug 2018 9:43]
MySQL Verification Team
Thank you for taking the time to report a problem. Unfortunately you are not using a current version of the product you reported a problem with -- the problem might already be fixed. Please download a new version from http://www.mysql.com/downloads/ Also we don't fix bugs in old versions, don't backport bug fixes, so need to check with latest version anyway. So, please, upgrade and inform us if problem still exists. -- 5.6.41 mysql> create table b (id int(10) primary key auto_increment,name varchar(10)); Query OK, 0 rows affected (0.00 sec) mysql> insert into b (name) values('aa'); Query OK, 1 row affected (0.00 sec) mysql> insert into b (name) values('bb'); Query OK, 1 row affected (0.00 sec) mysql> select * from b; +----+------+ | id | name | +----+------+ | 1 | aa | | 2 | bb | +----+------+ 2 rows in set (0.00 sec) mysql> show create table b\G *************************** 1. row *************************** Table: b Create Table: CREATE TABLE `b` ( `id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql> alter table b change id ID int(10) auto_increment; Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> show create table b\G *************************** 1. row *************************** Table: b Create Table: CREATE TABLE `b` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(10) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql> select * from b; +----+------+ | ID | name | +----+------+ | 1 | aa | | 2 | bb | +----+------+ 2 rows in set (0.00 sec) mysql> insert into b (name) values('cc'); Query OK, 1 row affected (0.00 sec) mysql> select * from b; +----+------+ | ID | name | +----+------+ | 1 | aa | | 2 | bb | | 3 | cc | +----+------+ 3 rows in set (0.00 sec) mysql> alter table b auto_increment=100; Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> show create table b\G *************************** 1. row *************************** Table: b Create Table: CREATE TABLE `b` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(10) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql> select * from b; +----+------+ | ID | name | +----+------+ | 1 | aa | | 2 | bb | | 3 | cc | +----+------+ 3 rows in set (0.00 sec) mysql> insert into b (name) values('dd'); Query OK, 1 row affected (0.00 sec) mysql> select auto_increment from information_schema.tables where table_schema='test' and table_name='b'; +----------------+ | auto_increment | +----------------+ | 101 | +----------------+ 1 row in set (0.00 sec) mysql> analyze table test.b; +--------+---------+----------+----------+ | Table | Op | Msg_type | Msg_text | +--------+---------+----------+----------+ | test.b | analyze | status | OK | +--------+---------+----------+----------+ 1 row in set (0.01 sec) mysql> alter table test.b auto_increment=200; Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> show create table test.b\G *************************** 1. row *************************** Table: b Create Table: CREATE TABLE `b` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(10) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=200 DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql> select * from test.b; +-----+------+ | ID | name | +-----+------+ | 1 | aa | | 2 | bb | | 3 | cc | | 100 | dd | +-----+------+ 4 rows in set (0.00 sec) mysql> alter table test.b auto_increment=4; Query OK, 0 rows affected (0.00 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> show create table test.b\G *************************** 1. row *************************** Table: b Create Table: CREATE TABLE `b` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(10) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql> insert into test.b (name) values('dd'); Query OK, 1 row affected (0.01 sec) mysql> insert into test.b (name) values('dd'); Query OK, 1 row affected (0.00 sec) mysql> show create table test.b\G *************************** 1. row *************************** Table: b Create Table: CREATE TABLE `b` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(10) DEFAULT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=103 DEFAULT CHARSET=latin1 1 row in set (0.00 sec) mysql> \q
[6 Aug 2018 10:52]
Jan jan
thank you very much for your reply.i have read MySQL 5.6 Release Notes before you answer me,but don't seems to find it in the Bugs Fixed.so i'm not sure if it's a bug or not.could you point out it?thank you very much again.