Adding a new column to a production database is one of the most common changes in software. It is also one of the riskiest if you ignore migration strategy. A badly timed ALTER TABLE can lock writes, block reads, and cascade latency spikes across services. The balance is between speed, safety, and data integrity.
First, define the schema change. Choose a precise column name and data type. Avoid implicit conversions that force full table rewrites. In systems like PostgreSQL, adding a nullable column with a default can still rewrite the entire table. In MySQL, the impact depends on storage engine and version. Check your database documentation before running the statement.
Second, plan the migration. For large tables, consider adding the new column without defaults, then backfilling in small batches. This reduces lock time and keeps the database responsive. Use idempotent scripts so the process can be paused or retried without corruption. Track the change through version control, treating schema as code.