Làm thế nào để thêm 1 cột vào 1 bảng có size lớn (ví dụ hàng triệu row) trong khi down time = 0

 Keyword để google là 

Alter large table without downtime



câu trả lời là

ALTER TABLE `example` ADD `example_column` TINYINT(1) DEFAULT NULL,
ALGORITHM=INPLACE, LOCK=NONE;
chú ý
ALGORITHM=INPLACE, LOCK=NONE chỉ apply được với column có default value là null

Comments

Popular posts from this blog

What are best practices to improve DB performance