Adding a new column can be simple in a development branch and punishing in production. In high-traffic systems, a blocking ALTER TABLE can freeze writes and pile up queries. A careless schema change can break services that depend on the old structure. Every decision must balance speed, safety, and clarity.
First, define exactly what the new column represents. Choose the tightest possible data type to save storage and improve index performance. Avoid ambiguous defaults. If the column must allow NULL, confirm no dependent code assumes a value is always present.
In Postgres, a ALTER TABLE ... ADD COLUMN without a default will commit instantly, even on large tables. Adding a default with NOT NULL can rewrite every row—plan for it. In MySQL, even small changes can lock the table, so test on a replica before touching production.
Deploy schema changes in controlled stages. Add the column with no constraints, backfill in batches, then add indexes or constraints after the data is in place. This minimizes downtime and reduces the risk of long transactions.