Adding a new column to a production database is deceptively simple. The wrong approach can lock tables, block writes, and stall the entire system. The right approach makes the change invisible to users while preserving integrity and speed.
A new column begins with design. Decide its type, nullability, default value, and indexing. In many systems, adding the column with a default that forces a rewrite will trigger a full table scan. That means downtime. Avoid it. Instead, create the column as nullable, backfill in small batches, then enforce constraints when the data is ready.
For relational databases like PostgreSQL, use ADD COLUMN without defaults in the initial migration. Apply updates in steps. This pattern minimizes locks and keeps replication safe. In MySQL, consider ALGORITHM=INPLACE when supported. If the table is large, test on a clone before touching production.