A schema changes. The database stops. Your query fails. You need a new column.
Adding a new column sounds simple, but the wrong approach can block writes, lock tables, or take down production. The right method keeps your data safe, your service online, and your migration fast.
First, define exactly what the new column will hold. Pick the smallest data type that works. Smaller types reduce storage cost and speed up queries. Set defaults only when they have meaning. Avoid arbitrary defaults that write useless data to every row.
Second, choose the migration strategy. For large tables, do not run a blocking ALTER TABLE. Use online schema change tools or database-native features that add columns without locking—such as ADD COLUMN with ALGORITHM=INSTANT in MySQL 8 or ALTER TABLE ... ADD COLUMN with low-lock in PostgreSQL. For massive datasets, batch the update or backfill asynchronously. Measure migration time in staging before production.