The database waits. You run the query, but the schema doesn’t match the vision in your head. You need a new column. Not tomorrow. Not after a sprint. Now.
Adding a new column is one of the most common schema changes, yet it’s also one of the easiest to mishandle at scale. A careless ALTER TABLE can lock rows for far longer than you expect. On production, that’s risk. Downtime is expensive, and the wrong migration strategy can cascade into errors across services.
The first step is planning. Define the new column with clear constraints. Decide on type, nullability, and defaults. Avoid defaults that force a full table rewrite if you’re dealing with millions of rows. For PostgreSQL, adding a nullable column or one with a constant default is fast—other defaults will not be.
For existing data, write an idempotent backfill. Run it in batches. Monitor the load. Keep transaction times short so replica lag stays low. Test on staging with a realistic dataset size; toy fixtures won’t reveal the real performance profile.