Adding a new column is simple. Doing it without downtime, without breaking code, and without corrupting data is harder. The database schema is the backbone of any system. A careless change can cascade into outages and lost trust.
First, decide if the new column is nullable or has a default value. In most production systems, adding a column with a constraint that blocks inserts will cause failures in running services. If you must add a column with NOT NULL, backfill it in two steps: create it as nullable, update rows in batches, then enforce constraints.
In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast for nullable columns without defaults. But for large tables with defaults, the database may rewrite the entire table, locking it for the duration. Use ALTER TABLE ... ADD COLUMN ... DEFAULT ... with care, or split the operation into adding the column first, then setting the default in a subsequent update.
In MySQL, ALTER TABLE often rebuilds the table. For large datasets, this means long locks. Use ALGORITHM=INPLACE or tools like gh-ost or pt-online-schema-change to avoid full rebuilds and downtime.