The query ran fast and returned nothing. No errors, no delays—just silence where the data should be. You realize the schema has shifted, and a new column is the only way forward.
Adding a new column should be simple. In practice, it can break production, slow queries, and lock writes if not done right. Databases handle schema changes differently, and what works in one environment can stall another. Choosing the correct method depends on the database engine, the size of the table, and the downtime tolerance.
In PostgreSQL, ALTER TABLE ADD COLUMN is instant for metadata when adding a nullable column without a default. Add a default, and it rewrites the table unless you combine it with DEFAULT + NOT NULL in staged steps. In MySQL, adding a column to a table with many rows can trigger a full table copy unless you use online DDL with ALGORITHM=INPLACE or ALGORITHM=INSTANT where supported. In MongoDB, a new field can be added at write time without schema migration, but the application logic must handle old documents.