What would be the fastest way to add a new column in a large mysql table ?
Alter table add column creates a copy of the full table, and then replaces the old one with the new create table. While this process is running, the original table is readable, but all inserts and updates are stalled.
On large tables, the copy can take a long time, is there any way to reduce it ?
You are stuck doing the ALTER TABLE. The best possible way to effectively deal with this, is to use a MASTER-MASTER setup.
You can modify MASTER1 first, and just use MASTER2 in production. Then you switch over and do the exact opposite.
Don't do this live on an active system. For an active system, do this while you take the system down for regular maintenance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With