The query crashed without warning. The table was fine yesterday, but this morning it needed one thing: a new column.
Adding a new column should be simple. In SQL, the command is direct:
ALTER TABLE orders ADD COLUMN status VARCHAR(20);
It runs fast on small data sets. But with millions of rows, “fast” becomes relative. Every row must store a default value or accept NULL. Schema changes are not just about syntax—they are about locking, migration windows, replication lag, and downtime risk.
In PostgreSQL, adding a column with no default is instant. Adding one with a default rewrites the table. MySQL behaves differently. Some NoSQL databases don’t even call it a “column,” but the problem remains: adding structure without breaking production traffic.