Answer the question
In order to leave comments, you need to log in
mysql: slow alter?
Hi guys. There is a need for production in a table in which 1M records to insert one more field.
But alter in mysql copies the entire table , which is why such an operation is very long. Server - combat, simple - unacceptable. Maybe there is a possibility to add one more field to the table so as not to block the site? What do you suggest?
Debian 5, Mysql 5.1,
2gb ram, Intel® Atom(TM) CPU D510 @ 1.66GHz
+ replication server connected (slave)
Answer the question
In order to leave comments, you need to log in
Since you have mastered normal replication, then deal with master-master replication as well. Alternately on each server make ALTER. While ALTER is running, send requests to another server.
>2gb ram, Intel® Atom(TM) CPU D510 @ 1.66GHz
>Server - combat, simple - unacceptable.
I don't really believe it, by the way.
CREATE TABLE new_name (new Layout);
INSERT INTO new_name
SELECT (column_list) FROM old_name;
RENAME TABLE old_name TO to_delete_name, new_name TO old_name;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question