Adding a new column sounds simple. In production, it is anything but. Schema changes can lock tables, block writes, and cascade into outages if not planned. Whether the database is PostgreSQL, MySQL, or any distributed SQL engine, the process demands atomic steps and a clear rollback path.
Start with a precise definition of the new column: name, data type, constraints, and default values. Avoid defaults on large tables unless you can afford the write cost. In PostgreSQL, adding a nullable column without a default is instant; adding one with a default rewrites the table. On MySQL, column order changes can force a full table rebuild. Understand the implications before you alter schemas in production.
Perform the change in phases. First, deploy application code that can handle both the old schema and the new column. Next, add the new column with minimal locking. Backfill data in controlled batches using queued jobs or maintenance windows to prevent load spikes. Then switch application reads and writes to the new column. Finally, clean up old paths only when all consumers are verified.