The database groaned when the migration hit, and the logs showed why: a new column had been added without thought for scale.
Adding a new column is routine, but the cost can be high if done wrong. On large tables, an ALTER TABLE locks writes and slows reads. The impact grows with table size, indexes, and replication lag. Choosing the right strategy is the difference between a clean deploy and a midnight outage.
First, determine if the new column can be a virtual or computed field instead of physical storage. For physical columns, check the default value and nullability. Adding a NOT NULL column with a default can rewrite the whole table. Adding it as nullable and backfilling rows in batches prevents downtime.
Use online schema change tools like gh-ost or pt-online-schema-change for MySQL, and pg_repack for PostgreSQL. These copy data to a new table with the column in place while keeping reads and writes active. On systems like MySQL 8 and PostgreSQL 11+, some ALTER TABLE operations are optimized for instant column addition—know your engine’s capabilities before you run anything in production.