Adding a new column should be fast, safe, and predictable. But in production systems, the wrong approach can lock tables, spike CPU, or cause downtime. The goal is to evolve your schema without breaking your app.
First, define the new column and its type. Use the minimal type that supports your data. Avoid defaults that trigger a full-table rewrite unless required. For high-traffic tables, consider adding the column as nullable with no default, then backfill in small batches.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward but may still require careful planning. On MySQL, online DDL (ALGORITHM=INPLACE) can reduce locking, but not all column changes support it. In both systems, measure the migration on staging with production-like data.