The schema broke when the query ran. The error log pointed to a missing field: the new column wasn’t there.
Adding a new column sounds simple, but in production systems it can decide the difference between uptime and downtime. Schema changes touch storage, indexing, migrations, and code paths. A poorly planned ALTER TABLE can lock rows, spike CPU, and block writes.
Start with clarity. Define the purpose of the new column. Is it nullable? What’s the data type? Will it need an index immediately or can indexing wait until after backfill? Every choice impacts performance and compatibility.
In relational databases, adding a column in place can cause full-table rewrites. On massive datasets, that means hours of disruption unless you use an online schema migration tool. For PostgreSQL, features like ADD COLUMN with a default value can trigger a rewrite; in MySQL, Online DDL can avoid downtime if configured correctly. Always test the migration on a copy of production data.