Adding a new column to a database table sounds small. A schema change. A quick upgrade script. But in production, the wrong approach can lock tables, block writes, or cause cascading failures. The right approach keeps the system running under load while the new column appears without downtime.
When introducing a new column, start with a precise definition of the change: column name, data type, nullability, default values, indexing. Each decision affects storage, performance, and maintainability. If default values are static and the table is large, avoid rewriting the entire table in one transaction. Use a nullable column and backfill in controlled batches.
For relational databases like PostgreSQL or MySQL, add the new column with an ALTER TABLE statement. Where possible, use operations that are metadata-only to avoid rewriting the table. In PostgreSQL, adding a new nullable column without a default is fast. If a default is required for every row, consider a two-step process: add the column as nullable, populate data in chunks, then set the default and not-null constraint.