The task was simple: add a new column. But in production systems, nothing is ever simple.
Adding a new column is one of the most common database changes. It can block queries, lock tables, trigger migrations that run for hours, or break integrations if not planned. The process must be understood and controlled to avoid downtime.
In relational databases like PostgreSQL, MySQL, and SQL Server, a new column definition changes the structure of a table. The operation can be fast if the column is nullable and has no default. But adding a column with a non-null default forces the database to rewrite every row. On large tables, that becomes expensive in both time and I/O.
In distributed systems or high-traffic apps, schema changes should be staged. Rolling out a new column often starts with adding the column in a safe form: nullable, without defaults, with no constraints. Then, backfilling happens in batches, using a background job. Finally, constraints and defaults are added once all data is populated.