The table was live in production when the alert hit: data needed to be stored differently, and it had to happen now. The fastest, safest way forward was to add a new column without bringing the system down.
A new column in a database sounds simple. It isn’t. Schema changes can lock tables, block writes, and stall traffic if handled carelessly. Choosing the right strategy depends on table size, database engine, and uptime requirements.
In PostgreSQL, adding a new column with a default value writes to every row. On large tables, this can be expensive. Using ALTER TABLE ... ADD COLUMN with a NULL default avoids immediate rewrites, then you can backfill in batches.
In MySQL, ALTER TABLE is often a blocking operation. For high-traffic systems, use tools like pt-online-schema-change or gh-ost to add a new column without downtime. These tools create a ghost table, copy data incrementally, and swap it in seamlessly.