Adding a new column in a database is simple until it is not. Schema changes can cause locking, downtime, or unintended side effects. The key is to understand not only how to add a column, but how to do it safely in production without risking the integrity or speed of the system.
A new column changes the shape of your data. It expands the contract between your storage layer and your application code. In relational databases like PostgreSQL or MySQL, adding a column with a default non-null value can rewrite the entire table, causing performance degradation. In high-traffic systems, this can bring requests to a halt.
The safest path is to add the column as nullable with no default. Backfill data in small batches, ideally through a background job. Once the data is in place, update the schema to enforce constraints. This multi-step deployment avoids long locks and rolling restarts.