The query ran for five minutes before anyone noticed. Then the logs showed it: a missing index and a new column added to a critical table in production without a migration plan.
Adding a new column to a database table should be simple. It rarely is. Even a single ALTER TABLE can lock rows, block writes, or break downstream services. The larger the dataset, the greater the risk of slow queries, replication lag, and unpredictable load spikes.
The first step is clear: define the type, constraints, and default values for the new column before touching the schema. Schema changes in production must consider storage impact, indexing strategy, and compatibility with existing queries. Adding a column with a NOT NULL constraint and no default will fail if the table is large; the database must rewrite each row.
In PostgreSQL, using ALTER TABLE ... ADD COLUMN creates the metadata instantly if defaults are not set. In MySQL, operational behavior varies by engine—InnoDB can add columns in place for some cases, but fallback to table rebuilds for others. Each platform handles the new column differently, and understanding these mechanics is critical for uptime.