Adding a new column should be simple, but the wrong approach can lock tables, drop performance, or break deployments under load. Every database engine has its constraints. Understanding how to add a column without downtime, data loss, or blocking writes is the difference between smooth operations and a war room incident.
First, know your environment. In PostgreSQL, ALTER TABLE ADD COLUMN is fast if the column is nullable with no default. Adding a default rewrites the table, blocking queries. Instead, add the column without a default, then run an UPDATE in small batches. Afterward, set the default at the schema level.
In MySQL, InnoDB can use instant DDL for adding certain columns in recent versions, but older versions still rebuild the table. On large datasets, consider online schema change tools like pt-online-schema-change or gh-ost to avoid downtime.