Adding a new column should be fast, predictable, and safe, no matter the size of your dataset. Done right, it won’t bring down production or block writes. Done wrong, it can lock tables, cause race conditions, or corrupt data. The process depends on your database engine, existing indexes, constraints, and replication setup.
In PostgreSQL, ALTER TABLE ADD COLUMN is transactional and usually instant if there’s no default value—metadata only. Add a default or NOT NULL constraint, and the database must rewrite the entire table, which can stall queries for minutes or hours on large datasets. For online migrations, create the column without defaults, backfill in batches, then set constraints.
In MySQL, behavior changes by version and engine. InnoDB after 5.6 supports fast column addition in many cases, but adding columns in the middle of the table layout still triggers a full table rebuild. Online DDL with ALGORITHM=INPLACE can help, but for strict uptime requirements, consider tools like pt-online-schema-change or gh-ost for zero-downtime schema changes.