Altering the data type of a column in a HUGE table. Performance issues

Well, you need

 ALTER TABLE table_name CHANGE col_name new_name VARCHAR(255)

But, you are right, it takes a while to make the change. There really isn't any faster way to change the table in MySQL.

Is your concern downtime during the change? If so, here's a possible approach: Copy the table to a new one, then change the column name on the copy, then rename the copy.

You probably have figured out that routinely changing column names in tables in a production system is not a good idea.


another variant to use percona toolkit https://www.percona.com/doc/percona-toolkit/2.2/pt-online-schema-change.html

Tags:

Mysql

Alter