The query ran too long. The deadline was tight. A new column had to appear in production without breaking anything.
Adding a new column sounds simple. It’s not. In a live database, schema changes can lock tables, block writes, and cause downtime if done carelessly. The right approach depends on the database engine, the data volume, and the traffic pattern.
In PostgreSQL, adding a new column with a default value rewrites the table. On large datasets, that means minutes or hours of blocked operations. Instead, add the column without a default, then backfill in small batches. In MySQL, ALTER TABLE can be instantaneous with ALGORITHM=INPLACE or ALGORITHM=INSTANT, but only for certain column types and operations. Always check the execution plan before running changes in production.