Adding a new column is one of the most common schema changes in modern applications. Done well, it increases functionality without breaking existing queries. Done poorly, it can lock tables, spike CPU, and stall deployments.
To create a new column safely, start with understanding your database engine. In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but defaults, NOT NULL constraints, and data backfills can trigger costly rewrites. In MySQL, adding a new column may require a table copy depending on the storage engine and version. Always check whether your system supports ONLINE DDL or in-place schema modification.
Plan for backward compatibility. Deploy the new column without constraints first. Make the schema change fast and non-blocking. Populate values asynchronously with background jobs. When existing rows are filled, apply constraints in a second migration. This keeps production online and removes risk during rollout.