Adding a new column to a production database is simple in syntax but heavy in consequence. It changes your data model, impacts queries, and can break upstream services if done without care. In high-traffic systems, even a minor ALTER TABLE can trigger locks, block writes, or spike CPU.
Start with precision. Define the column name, type, and constraints. Decide if it should be nullable or have a default value. This choice alone determines whether the migration is instant or a potential bottleneck. Avoid backfilling data in a single transaction on large tables—batch the updates or use a background job.
Plan for code changes before the column exists. Add read support only after the migration is deployed. Write support last. This prevents race conditions when different instances run different versions of the code. Use feature flags to control rollout.