The query returns fast, but the new column doesn’t exist yet. You run the migration. The table changes. The feature works.
Adding a new column should be simple. In practice, it can lock tables, block writes, slow queries, and take production down if handled carelessly. Schema changes are high‑risk, especially at scale. A clean, repeatable process is the only shield against chaos.
First, decide if the new column is nullable. Non‑nullable columns on large datasets can trigger full table rewrites. Start with nullable, deploy, backfill, then enforce constraints in a later migration. This lowers operational risk.
Second, run DDL operations in a controlled environment. Test migrations on production‑like data. Verify execution plans, locks, and timing. Many databases offer online schema change tools—use them. They keep the table available while the column is added, reducing downtime to near zero.