Adding a new column to a database table is one of the most common schema changes in production systems. Done wrong, it causes downtime, locks, or slow queries. Done right, it’s invisible to users. The execution depends on your database engine, your data size, and your tolerance for risk.
In PostgreSQL, ALTER TABLE ADD COLUMN is instant for empty columns with defaults defined as constant expressions. But adding a column with a volatile default or NOT NULL constraint can rewrite the entire table. In MySQL, adding a column can trigger a full table copy unless you’re on an engine that supports instant DDL. In large datasets, these differences matter.
A safe pattern is to add a nullable column first, backfill data in controlled batches, then add constraints. Use a migration tool that manages locks and retries. Keep the schema and application in sync by deploying code that can handle both old and new states until the rollout is complete.