The database was fast, but the query failed. The reason was simple: a new column had been added, and no one accounted for it.
Adding a new column is one of the most common schema changes. It looks trivial, but it can bring production systems to a halt if handled poorly. Schema migrations that include a new column can cause locks, replication lag, or data inconsistencies. The right process can make it safe and fast.
First, define the new column explicitly in your migration scripts. Set defaults with care. Avoid default expressions that force a table rewrite, since that can lock large tables for minutes or hours. When possible, add the column as NULL to prevent full-table updates during the migration.
Second, consider how the application will use the new column. Deploy code changes that read from it only after the migration completes everywhere. If you must backfill data, run the backfill in small batches to avoid saturating I/O or replication streams.