The database was ready to ship, but the schema needed one last precision cut: a new column. You had the query. You had the plan. But execution speed and zero-downtime were the real tests.
Adding a new column is not just an ALTER TABLE command. It can lock the table, block writes, or trigger expensive rewrites. On small datasets, you may never notice. On production-scale data, the wrong migration can halt critical operations. This is why every decision matters.
First, define the column type with intent. Choose the smallest data type that fits the data. Every extra byte will multiply across millions of rows. Second, decide on NULL vs NOT NULL early. Adding a NOT NULL column with a default in a single step can force the database to rewrite every row. In PostgreSQL, adding without a default, then updating in batches, can avoid downtime. MySQL requires similar discipline.