Adding a new column to a database table seems simple, but done wrong, it can lock queries, block writes, and break systems under load. Whether you run PostgreSQL, MySQL, or a cloud-hosted database, the wrong migration can turn production into downtime.
A new column often means a table rewrite. Large tables can take minutes or hours to alter, and any transaction that touches them will wait. Online schema change tools—built into some databases or available as external utilities—can create a new column without locking the whole table. The strategy is to add the column in a way the engine treats as metadata-only, then backfill data in controlled batches.
Plan the migration in steps. First, add the new column with a null default and no constraints. This avoids rewriting existing rows at creation time. Second, run a background job to populate the column in small chunks, watching for query impact. Finally, set the default value and add any indexes or constraints only after the data is ready.