The database table was ready, but the product needed more. A new column had to be added, and every second counted.
Adding a new column sounds simple. In practice, performance, locking, and schema integrity make it a surgical change. The choice between ALTER TABLE and a migration strategy can decide whether the application stays online or burns through downtime.
The ALTER TABLE ... ADD COLUMN statement modifies the schema directly. In small datasets, it’s fast. In large tables, especially on production, it can lock writes and cause delays. PostgreSQL, MySQL, and other relational databases each handle new columns differently. Knowing the exact behavior before executing is essential.
With PostgreSQL, adding a nullable column with no default is nearly instantaneous. Adding a NOT NULL column with a default rewrites the table and can block operations. MySQL can also block writes depending on its storage engine version. Understanding these execution paths allows for safe scheduling and minimal user impact.