A new column is one of the most common schema changes in modern databases. It looks simple. It’s not. Whether you work with PostgreSQL, MySQL, or a distributed system like CockroachDB, adding a new column can trigger table rewrites, lock writes, or cause replication lag. The way you perform this change decides if your service keeps running or grinds to a halt.
The key is to understand the impact on performance and availability. Adding a column with a default value in PostgreSQL before version 11 rewrites every row. In large datasets, that can take minutes or hours and block other queries. Newer versions optimize this, but only for constant defaults. MySQL behaves differently—ALTER TABLE often locks the table, depending on storage engine and specific column definition.
Plan ahead. Run schema migrations in staged rollouts. Use nullable columns first when possible, then backfill values in batches. Monitor replication lag closely. On high-traffic systems, test the migration against production-sized datasets in staging before touching the real thing.