Adding a new column is one of the most common changes in database development, yet it is also a source of performance issues, downtime, and broken code when done poorly. Whether in PostgreSQL, MySQL, or a distributed SQL system, the way you add a column matters. Schema changes touch production data, indexes, queries, and often the deployment process itself.
The simplest ALTER TABLE ADD COLUMN works for small tables. On large datasets, it can lock writes, block reads, and stall the application. Some engines allow instant column addition if defaults are null and no backfill is required. Others rewrite the entire table in place. Understanding the execution plan for a schema change is critical before you run it.
When adding a new column with a default value, test both the migration and the application layer. Pre-filling millions of rows in one transaction can saturate I/O and cause replication lag. Gradual backfill strategies or online schema change tools can mitigate these risks. In PostgreSQL, setting the default at creation avoids null-handling logic but may lock longer. MySQL’s ALGORITHM=INPLACE can add columns without a full copy, depending on the definition.