Creating a new column in a database table can be simple, but in production it’s never just ALTER TABLE. The command is the easy part. The challenge is making changes without downtime, data loss, or unexpected locks. This is the difference between a migration that’s safe and one that takes your system offline.
When you add a new column, the database engine will write metadata changes and, depending on the type, may rewrite or scan every row. In PostgreSQL, adding a column with a DEFAULT value forces a table rewrite. In MySQL, certain column additions can trigger a full copy. On high-traffic tables, this risks blocking reads or writes.
The safest pattern is to add the new column as nullable, deploy, then backfill data in controlled batches. Only after the backfill completes should you enforce constraints or defaults. This reduces lock times to near zero and keeps your application live.