Adding a new column is one of the most common schema changes. Done wrong, it can lock tables, slow queries, or cause downtime. Done right, it’s invisible to the user and safe for production. The difference is in how you plan and execute the change.
First, confirm the purpose of the new column. Define its name, type, nullability, and default value. Tight definitions reduce refactoring later. If the column will store large data or high-write values, consider storage costs and indexing impact before you touch the schema.
In production, never add a new column blindly. For large tables, adding a column with a default value can block writes while the database rewrites data. Use an online migration tool or roll out changes in phases. In PostgreSQL, adding a nullable column without a default is typically fast. For MySQL, online DDL can help avoid table locks.
If you need to backfill the new column, do it in batches. This reduces load and avoids performance spikes. Monitor replication lag if you run a read-replica setup. Keep each backfill idempotent so you can resume after a failure.