Adding a new column sounds simple, but in a production system it can break deployments, slow queries, and lock rows at scale. The wrong approach can force downtime or cause data loss. The right approach keeps performance stable and migrations safe.
First, define the purpose. A new column must have a clear role in your schema. Document its type, constraints, defaults, and nullability before touching the database. Avoid implicit defaults for large datasets—changing millions of rows in a single transaction can halt writes and put latency through the roof.
Second, choose the right migration strategy. For relational databases like Postgres or MySQL, adding a nullable column without defaults is fast. If you need defaults, add the column first, then backfill in small batches. For non-relational systems, ensure the schema change is backward-compatible with existing reads and writes.