Adding a new column is one of the most common schema changes. Done wrong, it locks tables, stalls queries, and breaks production. Done right, it’s fast, safe, and invisible to the users.
The first step is knowing your environment. In relational databases like PostgreSQL or MySQL, a simple ALTER TABLE works for small datasets. For large tables under heavy load, use migrations that avoid full table rewrites. Add the column as nullable, then backfill data in batches. Only after the data is ready should you enforce constraints or set defaults.
For distributed systems, every node must understand the new column before it’s populated. Deploy code that can read and ignore the column first. Deploy code that writes to it second. This prevents runtime errors and mismatched schemas. When running migrations in production, schedule them during low-traffic windows or behind feature flags.