Adding a new column sounds simple. It isn’t. A single schema change can block deploys, break queries, and lock tables under load. In databases serving live traffic, a careless ALTER TABLE can stall everything. The right approach avoids downtime, preserves data integrity, and plays well with production constraints.
Start with a clear reason for the new column. Define the name, type, default, and nullability before touching the schema. Guessing later leads to costly rewrites. Document the change where both code and humans can read it.
In PostgreSQL, adding a column without a default is fast. Adding a default that needs to rewrite rows is not. Use ADD COLUMN ... DEFAULT ... with caution, or add it in two steps: create the column as nullable, backfill in batches, then set NOT NULL and the default.
In MySQL, adding columns to large tables can trigger a full table copy depending on engine and version. Check whether your version supports instant column addition. If not, plan for an online schema change using tools like pt-online-schema-change or gh-ost to keep writes flowing.