Adding a new column seems simple, but the wrong approach can lock tables, slow queries, or trigger downtime. The right method depends on scale, database engine, and schema design. In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward for small datasets. For large, high-traffic tables, you need a migration strategy that writes the column without blocking reads and writes.
First, confirm the column’s type, default values, and constraints. Adding a NOT NULL column with a default can rewrite the entire table—dangerous for big datasets. In PostgreSQL 11+, adding a column with a constant default no longer rewrites, which is safer. MySQL’s ALTER TABLE still copies the table in many scenarios unless you use an engine with instant DDL support like InnoDB’s ALGORITHM=INSTANT.
When working on live systems, break the change into two phases.