The schema was locked. The boss wanted it changed by morning. You needed a new column, and you needed it without breaking production.
Adding a new column should be simple. In reality, it can be risky. Downtime, migration errors, and bloated tables can cripple performance. The speed and safety of the operation depend on how you plan and execute the change.
A new column starts with defining its purpose. Is it for tracking a new metric, supporting a feature, or holding derived data? Once defined, choose the correct data type. Keep types narrow to save space and ensure faster queries. Avoid TEXT and BLOB unless absolutely necessary.
Next comes migration strategy. For large datasets, never run a blocking ALTER TABLE. Tools like pt-online-schema-change or native database features for online DDL prevent locking. In PostgreSQL, ADD COLUMN is fast, but adding defaults can still trigger a full rewrite. Use NULL with defaults in code first, then backfill in batches.