The query ran. The logs were clean. But you needed a new column, and every instinct told you it had to be right the first time.
Adding a new column can look simple. In production systems, it is rarely so. Schema changes can lock tables, block writes, and cause downtime. The impact grows with data size. Large migrations can run for hours. The wrong plan can turn a trivial change into an outage.
Before you add a new column, define the exact type, default value, and nullability. Unclear definitions create ambiguity and increase the risk of backfills or application errors. Decide if the column should allow nulls, have strict constraints, or use generated values.
Choose the right method for your database engine. In PostgreSQL, ALTER TABLE ADD COLUMN with a constant default rewrites the table. This operation can be expensive. Adding the column as nullable first, then updating in small batches, often avoids locks. MySQL can perform some additions instantly with ALGORITHM=INSTANT, but only under specific conditions. Read your engine’s documentation before running commands.