Adding a new column to a database is simple in theory but risky in production. It can block writes, lock tables, or break downstream services if done wrong. The right approach depends on the database engine, data volume, and uptime requirements.
In PostgreSQL, a new nullable column with no default is instant. But adding a column with a default value rewrites the table, which can lock it for minutes or hours. For large datasets, break the operation into multiple steps: first add the column as nullable, then backfill in batches, then add the default.
In MySQL, even small schema changes can cause table copies unless you use ALGORITHM=INPLACE or ONLINE options when supported. Always check the execution plan before running ALTER TABLE. Avoid triggers during migrations, as they can multiply the impact of every row change.