The table was running hot, queries choking on joins, and every change risked downtime. You needed a new column, and you needed it now.
Adding a new column in production is simple in theory but dangerous in practice. Schema changes can lock tables, block writes, or spike CPU. The right approach depends on your database engine, table size, and query patterns.
In PostgreSQL, adding a nullable column with no default is fast. It updates the catalog without rewriting the table. But adding a column with a non-null default will rewrite every row, which can stall production traffic. To avoid this, add the column as nullable, backfill in batches, then set the default and constraints.
In MySQL, ALTER TABLE often rebuilds the table. On large datasets, this can take minutes or hours. Use tools like gh-ost or pt-online-schema-change to make the migration safer and non-blocking.
For distributed databases like CockroachDB or Yugabyte, schema changes propagate across nodes. Check for compatibility with rolling upgrades and read replicas before proceeding.