The query ran fast, but the schema was already wrong. A missing new column blocked the release.
Adding a new column seems simple until it is part of a live system under constant load. Poor planning here can lock tables, drop performance, and cause downtime. The right approach is precise, incremental, and tested before it hits production.
Start with a migration plan. Define the new column name, type, nullability, and default value. Consider how it affects indexes, queries, and application logic. Migrating large datasets requires chunked writes or online schema change tools like pt-online-schema-change or gh-ost.
Add the new column with a default value only if it won’t trigger a full table rewrite in your database engine. For MySQL and PostgreSQL, understand whether the operation is metadata-only or requires disk operations. Test on a staging dataset of production scale.