Adding a new column is one of the most common schema changes, but it can still bring a system to its knees if done wrong. Whether you use PostgreSQL, MySQL, or any relational database, a new column can change query plans, grow indexes, and trigger locks. In high-traffic production environments, even a simple ALTER TABLE ADD COLUMN can cause downtime if not handled with care.
Plan every schema change. Start by checking the size of the table. Large tables mean longer locks. For PostgreSQL, adding a nullable column with a default value will rewrite the entire table. If you only need the column and can backfill later, add it without a default first—the operation is instant. Then, populate the data in small batches to avoid blocking queries.
For MySQL, engine and version matter. Modern versions of InnoDB can add certain types of columns online, but older versions require the whole table to be rebuilt. Always run the change in a staging environment to measure execution time and verify indexes, triggers, and foreign keys remain intact.