The query finishes, but the data is wrong. You need a new column.
Adding a new column should be simple, but in production it carries weight. Schema changes can lock tables, slow writes, or break downstream code. The safest way to add a new column depends on your database engine, traffic pattern, and deployment strategy.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast for nullable columns without defaults. For large tables, adding a default with a single statement rewrites the table and can block queries. The zero‑downtime method is to first add the column as nullable, then backfill in small batches, and finally set the default and constraints after the backfill is complete.
In MySQL, adding a new column can trigger a full table copy, even for simple cases. Use ALGORITHM=INPLACE where supported, or tools like pt-online-schema-change to avoid locks. For high‑volume services, test schema changes in staging with realistic data and monitor query plans before deploying.