The query ran in two seconds, but the result was wrong. The schema had changed. A new column was in play, and nothing worked the same.
Adding a new column to a database is simple in theory, but can disrupt queries, indexes, and downstream systems if done without precision. The key is not just defining the column, but integrating it without breaking history or performance.
First, define the column in your schema with the correct type and constraints. Avoid nullable columns where possible to reduce ambiguity. Choose clear, consistent naming to prevent conflicts in client code.
Second, handle existing data before deploying to production. For large tables, backfill in small batches to avoid locking or blocking critical requests. Use migrations that are online-safe. Test them against a replica or staging environment to confirm performance.