Adding a new column to a production database should be simple. But without care, it breaks queries, slows indexes, and turns predictable systems into guesswork. The right approach depends on schema design, data volume, and uptime requirements.
The most common mistake is running a direct ALTER TABLE ADD COLUMN in systems with millions of rows. On large datasets, this can trigger a table rewrite and lock writes until it completes. For PostgreSQL, adding a nullable column with a default value before version 11 was especially dangerous—it rewrote the table for every row. MySQL and MariaDB also have engine-specific rules that can block reads or writes during an alter.
A safe new column migration starts with a zero-downtime plan. First, add the column without default values. This is often instant because the database only updates metadata. Next, backfill the column in batches to control load. Finally, update the default at the schema level once all data is written.