The query returned faster than expected. You open the database console, scan the schema, and realize what comes next: a new column.
Adding a new column sounds simple. In production, it can be dangerous. The table could be massive. The migration could lock rows, block writes, or trigger downtime. Every step matters.
First, define the new column with a clear purpose. Avoid vague names. Choose the smallest data type that fits the data. This controls size on disk, keeps indexes light, and reduces I/O overhead.
Second, decide how to handle null values. When the column is added, existing rows will need defaults or placeholders. Large updates in a single transaction can overload the database. Use batched updates when possible.
Third, align schema changes with application code. Deploy a version that works without the new column first. Then add the column. Then backfill data. Finally, deploy the version that uses it. This avoids breaking queries or API responses during the change.