I need to change a datatype from INT to BIGINT in a 600GB MySQL table. The column has a unique index. I might be good with unsigned INT, but I assume changing to that or BIGINT will be pretty much same pain. The table's engine is InnoDB. What would be easier:
- ALTER TABLE
- Copying structure and
INSERT INTO (SELECT *)
- Dumping table and changing dump file table definitions
- Anything else?
UPDATE: As requested, MySQL ver 5.5.15, no foreign keys and create table:
CREATE TABLE `tbl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`created_at` datetime NOT NULL,
`tid` bigint(20) NOT NULL,
`t` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`f` tinyint(1) NOT NULL,
`i_id` bigint(20) NOT NULL,
`ir_id` int(11) NOT NULL,
`r_c` int(11) NOT NULL,
`r` tinyint(1) NOT NULL,
`e` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`t` varchar(5) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user` (`user_id`,`tid`)
) ENGINE=InnoDB AUTO_INCREMENT=1657146169 DEFAULT CHARSET=utf8
ALTER TABLE ONLINE
. Do you have foreign keys referencing this column? It would help if you showed theSHOW CREATE TABLE tablename;
output.