Adding a new column to a database table sounds simple. It isn’t. Schema changes can break queries, lock tables, and block deploys. Done wrong, they cause downtime. Done right, they fit into your release flow with zero interruptions.
The key is understanding how your database engine handles DDL operations. In PostgreSQL, ALTER TABLE ADD COLUMN is generally fast if the column is nullable or has a constant default. In MySQL, adding a column can be instant with ALGORITHM=INPLACE or ALGORITHM=INSTANT depending on the version. But defaults, indexes, and constraints change the game. Adding a NOT NULL column without a default will rewrite the whole table. That’s hours of locks in large datasets.
Always check for backward compatibility. Adding a new column is easiest when you make it optional at first. Roll out the schema change. Deploy code that writes to it without reading it. Backfill in batches. Then enforce constraints. That sequence avoids race conditions and keeps deployments safe.