Adding a new column sounds simple. In production, it can be dangerous. Locking tables, slowing queries, breaking deployments—small schema changes can ripple across systems. The right approach depends on the database engine, the size of the table, and the use case for the column.
In PostgreSQL, adding a new column with a default value can trigger a full-table rewrite. On large datasets, that means downtime. Use ADD COLUMN without a default, then backfill in controlled batches. Apply the default constraint later. This keeps locks short and users happy.
In MySQL, ALTER TABLE often creates a copy of the table for structural changes. Online schema change tools like pt-online-schema-change or gh-ost can add a column without locking writes. Always test in a staging environment with production-like load. A schema modification that passes unit tests may fail under real traffic.