Adding a new column should be fast, safe, and predictable. Yet in production systems, it can trigger locks, block writes, or blow up deploy windows. The right approach depends on database engine, table size, and replication topology. There is no single command that works everywhere without thought.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward for small tables. The column is added instantly when no default value is set. With a default, Postgres rewrites data unless you use a nullable column and backfill in batches. For large datasets, use a background job to update rows, then add constraints once data is ready.
In MySQL, ADD COLUMN behavior differs by storage engine. InnoDB may rebuild the table, causing downtime. Online DDL features like ALGORITHM=INPLACE and LOCK=NONE reduce but do not eliminate risk. For very high-traffic tables, ghost migration tools such as gh-ost or pt-online-schema-change are safer.