Adding a new column is one of the most common schema changes, yet it carries risk. The wrong approach can lock tables, slow queries, or cause downtime. The right approach makes it invisible to users and safe for production.
First, decide how the new column will be used. If it holds optional data, use a nullable default to avoid a full table rewrite. If it must have a default value, consider applying the default only for future writes, then backfill in small batches to reduce load.
Choose the migration strategy based on your database engine. In PostgreSQL, ALTER TABLE ADD COLUMN with a default can cause a write lock unless you add it as nullable first. In MySQL, adding a new column can impact performance if you don’t use an online DDL operation. Always check whether your cloud provider supports online schema changes without downtime.