The query was simple. Add a new column. The table was in production, the traffic was high, and the margin for error was zero.
A schema change is one of the most sensitive operations in any data-driven system. Adding a new column to a live database can lock the table, block writes, or even cause downtime. The key is to do it without interrupting service. That means understanding the database engine, its storage engine, and how it applies DDL changes.
On MySQL with InnoDB, ALTER TABLE operations can copy the entire table, which is slow on large datasets. Online DDL (ALGORITHM=INPLACE or ALGORITHM=INSTANT) reduces impact, but even then you must weigh the cost in I/O and replication lag. PostgreSQL’s ADD COLUMN for a nullable field with a default NULL is instant, but adding a default value involves a full table rewrite in older versions. Knowing these differences is the only way to plan a safe migration.