Adding a new column is simple in theory, but dangerous in production. One wrong migration can lock tables, spike CPU, or break critical queries. It’s not just ALTER TABLE; it’s knowing when, where, and how to run it without downtime.
A new column changes the shape of your data. You need to decide its type, nullability, default values, and indexing strategy before the first command runs. Always profile the workload first. Adding a column with a default across billions of rows can throttle performance for minutes or hours. On modern PostgreSQL and MySQL releases, avoid setting the default at creation time if you can defer the backfill.
For high-traffic systems, migrate in phases. Step one: add the new column as nullable with no default. Step two: backfill data in small batches, monitoring query latency. Step three: apply constraints or indexes only after the backfill is done. This reduces risk and keeps the database alive under load.