A single column can break a feature, bottleneck a release, or block an entire deployment pipeline. Adding a new column sounds simple, but doing it in a live production database without downtime or data loss demands precision. It is not just ALTER TABLE. It’s schema planning, indexing strategy, and compatibility across services that already query the table.
When you add a new column, think about defaults. A NULL default might avoid locking, but might also wreck downstream logic. A populated default could fill historic data but risk large table rewrites. The decision changes depending on the database engine, row count, and replication lag. Always measure the cost before you run the migration.
For large tables, use online schema change tools. MySQL users lean on pt-online-schema-change or gh-ost. PostgreSQL can sometimes handle concurrent column additions without a lock, but adding a column with a default still rewrites the table. Break big changes into steps: add the column NULLable, backfill in batches, then add constraints when safe.