Adding a new column to a database table should be fast, safe, and predictable. Yet in production, schema changes can cause downtime, lock rows, or block writes. The way you add a column matters.
A new column changes the shape of your data. In SQL databases like PostgreSQL or MySQL, ALTER TABLE ADD COLUMN is the most direct command. It’s also the most dangerous when used without care on large tables. Databases may rewrite the table, invalidate caches, or scan every row to set a default value. On busy services, that can mean lag and errors users will see.
Best practice is to add the new column in stages:
- Add the column without a default or constraint.
- Backfill data with batched updates to avoid load spikes.
- Apply constraints or defaults only after backfilling is complete.
Check for ORM-level side effects. Migrations that assume the column exists instantly can break code paths. Rolling deployments need backward compatibility. Feature flags and conditional queries let you control exposure until schema changes are complete.