The table was ready, but the new column didn’t exist yet. You needed it now, not in the next release cycle.
Adding a new column to a production database isn’t just a schema change. It’s an operation that can lock writes, corrupt data if done wrong, or cascade into outages. The method you choose depends on your database engine, production traffic, and tolerance for blocked queries.
In MySQL and PostgreSQL, the simplest approach is ALTER TABLE ADD COLUMN. This works fast for small tables. On large datasets, it can rewrite the entire table and block concurrent access. That’s where online schema change techniques come in—tools like pt-online-schema-change, gh-ost, or PostgreSQL's ADD COLUMN with DEFAULT set to NULL to avoid a full rewrite.
When planning a new column, define the data type and nullability first. Adding a NOT NULL DEFAULT value can be dangerous at scale because it requires rewriting each row. Instead, add the column as nullable, backfill in controlled batches, then alter to NOT NULL if needed. This reduces lock times and replication lag.