The query ran in under a second, but the result was wrong. A new column had been added to production without a migration plan, and the dashboard was now showing nulls.
A new column sounds simple. One extra field in the schema. But the reality is that adding a column to a live database is a high‑risk change. It can cascade into broken queries, failed deployments, and unexpected downtime if not done with precision.
A safe process starts with defining the new column clearly: name, type, default, constraints. Decide if the column must be nullable from the start or if it can have a default value. Avoid defaults on large tables during peak load; some databases will rewrite the whole table.
Use migrations that are idempotent and version‑controlled. In Postgres, tools like ALTER TABLE ... ADD COLUMN are fast for nullable fields, but adding NOT NULL with a default to a large table will lock it. Break the change into steps: add column as nullable, backfill in batches, then apply constraints in a separate migration.