The table was live, traffic was high, and you needed a new column fast.
Adding a new column sounds simple. In production, it’s not. You deal with locks, write amplification, and potential downtime. On large datasets, a traditional ALTER TABLE ADD COLUMN can block queries and stall writes. In cloud environments, even managed databases choke if you push them without a plan.
First, define the column type, default values, and nullability. On many databases, adding a nullable column with no default is instant. Adding a not-null column with a default forces a full table rewrite. Understand the difference before you run commands.
For PostgreSQL, use ALTER TABLE ... ADD COLUMN with a nullable option, then backfill in batches. For MySQL, check if your version supports instant DDL. For systems like MongoDB, "adding"a new field is schema-less but your application code still needs to handle missing fields gracefully.