The query returned in under a second, but the data was wrong. The table was missing a new column that the system needed to process orders.
Adding a new column sounds simple. It isn’t—unless you handle it with precision. Schema changes can block writes, lock rows, or bring down live systems. On a busy database, reckless changes turn small edits into outages.
A new column must be designed with clarity. Pick the right data type. Keep it normalized. Decide on default values. Avoid NULL if possible—explicit values reduce ambiguity and improve query performance. For large datasets, add columns in stages: first without a default, then backfill in a separate job to avoid locking the table for too long.
In production, migrations should be zero-downtime. Use tools that run ALTER TABLE commands asynchronously. Break the deploy into safe steps. Always test on realistic data volumes. Monitor replication lag and slow query logs during the migration.