Adding a new column sounds simple. It can still break production if you get it wrong. The task sits at the core of database schema evolution. Whether you use MySQL, PostgreSQL, or a distributed SQL system, changing the schema impacts performance, runtime stability, and deployment flow. The wrong strategy can lock tables, drop indexes, or block writes.
A new column can be nullable or have a default value. Choosing between the two affects backfill costs and downtime. Adding a NOT NULL column without a default often requires rewriting the table. Large datasets make this dangerous and slow. With PostgreSQL 11+, adding a column with a constant default is metadata-only, avoiding a full table rewrite. MySQL’s behavior depends on the storage engine and version. Always check the release notes before assuming zero-downtime behavior.
When adding a column in production, migrate in stages. First, deploy code that ignores the column. Then alter the table to add the new column without touching rows when possible. Avoid locks by using online schema change tools like pt-online-schema-change or gh-ost. If the column will store computed data, prefill it in small batches using background jobs. Confirm the migration with a read-replica before promoting changes to the primary.