Adding a new column sounds simple. It’s not. The right way depends on your schema, your data volume, and your uptime requirements. A careless ALTER TABLE can lock rows for minutes or hours. In production, that means real downtime.
First, decide if the new column will be nullable, have a default value, or require a backfill. For large datasets, avoid immediate backfills. Add the column with a safe default and update data in small batches to prevent locking.
In PostgreSQL, ALTER TABLE ADD COLUMN runs fast if you skip defaults. Apply defaults in a separate UPDATE step. In MySQL, watch for table rebuilds, especially with older versions or certain storage engines. For distributed systems, add the column in one stage—then update your application code to reference it once every node sees the change.