Adding a new column in a production database is straightforward in theory. In practice, performance, locking, and backward compatibility can turn it into a liability. A careless schema change can block writes, cause downtime, or trigger silent data issues. Understanding the right way to add a new column separates clean releases from firefighting.
When introducing a new column, define its purpose and data type with precision. Favor explicit types over generic ones. Avoid adding a not-null constraint with a default on large tables in one step—this will run a table rewrite and lock the entire table. Instead, add the column as nullable, backfill the data in batches, and only then enforce constraints.
For zero-downtime deployments, pair schema changes with application code changes. Deploy the schema first in a non-breaking form. Deploy code that writes to and reads from the new column. Once data is consistent, enforce constraints and drop transitional logic.