The column name is the only thing that is changing... will MySQL rebuild that开发者_StackOverflow index?
create table t1(id int, name varchar(100));
alter table t11 add index name_idx(name);
mysql> show create table t11;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| t11 | CREATE TABLE `t11` (
`id` int(11) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
KEY `name_idx` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
alter table t11 change column name name1 varchar(100);
mysql> show create table t11;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| t11 | CREATE TABLE `t11` (
`id` int(11) DEFAULT NULL,
`name1` varchar(100) DEFAULT NULL,
KEY `name_idx` (`name1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql will auto change the indexes for u and does not rebuild index
Wouldn't have thought so for C-ISAM, not sure about INNODB. What happens when you try it?
精彩评论