The table was live, serving production traffic, when the need for a new column arrived. No delay, no luxury of a full migration window. The schema had to change, and it had to happen without breaking queries, corrupting data, or locking up the database.
Adding a new column sounds simple. In practice, the wrong approach can block writes, slow reads, or cause downtime. The goal is to make the change in place, safely, and fast. This means knowing how your database engine handles schema changes. Some systems rewrite the entire table on ALTER TABLE. Others support instant or online operations. Understanding these mechanics is the first step.
Define the column with the correct type, nullability, and default. Defaults are not free—adding a value to millions of rows during a migration can spike IO and lock time. For large datasets, add the column as nullable first. Backfill values in small batches to spread load. Only after the data is complete should you add constraints or non-null requirements.