Adding a new column is one of the most common schema changes in modern databases. Yet it can break production, block deployments, or create downtime if done without care. The right process makes it safe. The wrong process leaves you with locked tables, corrupted migrations, and angry users.
A new column in SQL is created with an ALTER TABLE statement. On small tables, it’s fast. On large tables, especially in Postgres or MySQL, it can take seconds or minutes, holding locks that block writes. This risk grows with indexes, constraints, or default values.
Best practice is to run the change in a transactional, backwards-compatible way. Add the new column as nullable without a default, then backfill in batches. Once complete, set the default and add constraints. In Postgres, consider ADD COLUMN ... DEFAULT with NULL to avoid table rewrites. For MySQL, assess whether online DDL options are available.