Adding a new column sounds simple. In production, it is not. The wrong approach can lock tables, drop queries, or slow an entire system. The right approach adds the field safely, preserves performance, and keeps data consistent under load.
First, decide whether the new column is nullable. Adding a non-null column with no default forces a full table rewrite. This can be expensive on large datasets. If the column can be null at first, you can backfill in separate steps to avoid blocking writes.
Use ALTER TABLE with care. Most modern databases, like PostgreSQL and MySQL, can add a nullable column instantly. Defaults, constraints, and indexes often require additional work. Adding indexes after backfilling data keeps operations fast.
For high-traffic systems, schedule the migration during low usage. Wrap changes in transactions when possible, but remember that big schema changes can exceed lock timeouts. Test in a staging environment with production-scale data.