Adding a new column to a table is one of the most common changes in database development. Done right, it’s simple. Done wrong, it blocks writes, spikes CPU, and locks tables when you can’t afford it. Whether you use PostgreSQL, MySQL, or another relational database, the principles are the same: plan the change, apply it with minimal impact, and verify without downtime.
Start by deciding the exact column name, data type, and constraints. In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but watch default values. Adding a column with a non-null default can rewrite the entire table, especially on large datasets. Use NULL initially, backfill in batches, then add NOT NULL constraints.
In MySQL, be aware of storage engines and version differences. Modern InnoDB often supports instant ADD COLUMN, but not for every case. Large text or blob columns can trigger a full table copy. Always check the execution plan for schema changes in staging before production.