Adding a new column is one of the most common schema changes in modern applications. It sounds simple, but the way you do it impacts performance, uptime, and maintainability. Whether you are working with PostgreSQL, MySQL, or a distributed SQL engine, the process follows the same critical principles: plan for safety, migrate without blocking writes, and keep deployments predictable.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward for small datasets. For large production tables, it can trigger a full table rewrite if you assign a default value. This can lock the table and stall your app. A safer approach is to add the column without a default, backfill values in batches, then apply the default constraint once the table is updated.
In MySQL, adding a column is online in newer versions when using ALGORITHM=INPLACE or ALGORITHM=INSTANT. This avoids copying table data, making the migration near-instant in some cases. But always test — storage engines and version differences can change behavior.