Adding a new column sounds simple. It isn’t. Schema changes in production databases carry risk. There is downtime risk. There is locking risk. There is data integrity risk. If your system handles real traffic, you cannot just run ALTER TABLE without a plan.
A new column changes the shape of your data. If it’s not added with default values, queries can break. If it’s not indexed, performance can fall off a cliff. If it’s not rolled out in sync with your application code, you can hit undefined states where deployed services are speaking different schemas.
The safest approach is to treat new column creation as part of an atomic, staged rollout:
- Add the column in a backward-compatible way.
- Deploy code that writes to both old and new columns.
- Backfill data in controlled batches, avoiding long locks.
- Switch reads to the new column.
- Remove the old column, if needed.
Every database engine handles new columns differently. PostgreSQL can add nullable columns almost instantly, but adding with defaults may require table rewrites. MySQL may lock the table for more operations than you expect. Understand your engine’s behavior before touching production.