Adding a new column seems simple, but in production systems it is a precision task. The wrong approach can lock tables, block queries, or break downstream services. The right approach is fast, safe, and repeatable. Whether you are running PostgreSQL, MySQL, or a distributed SQL engine, you must choose a migration strategy that fits the size and shape of your data.
In PostgreSQL, ALTER TABLE ... ADD COLUMN is usually instantaneous for empty columns with defaults set to NULL. But adding a column with a non-null default may rewrite the entire table. That can mean downtime. To avoid this, set the default after creation or backfill in controlled batches. In MySQL, behavior varies by storage engine and version, so always confirm on a staging clone before hitting production.
If you manage terabyte-scale data, schema changes need more than a single SQL command. Tools like pt-online-schema-change or gh-ost for MySQL, or background migrations for Postgres, keep tables online while adding the new column. Pair them with feature flags to roll out related code changes in sync.