The requirement changed: add a new column.
Adding a new column sounds simple. In practice, it can break deployments, trigger downtime, and burn hours in debugging. Schema changes in production demand precision. A poorly executed ALTER TABLE on a large dataset can lock writes, spike CPU, and cause replication lag.
The safest way to add a new column is to treat it as a migration, not a patch. Start by defining the column’s data type, default value, and constraints. Avoid adding expensive defaults that rewrite existing rows. For large tables, use nullable columns first, backfill in batches, and then apply NOT NULL constraints after the data is in place.
Test the migration on staging with realistic data size. Benchmark query plans that touch the new column to ensure indexes remain optimal. Monitor performance metrics during rollout, including replication delay and disk usage. If working in a distributed SQL or sharded database, ensure the migration strategy accounts for data distribution and consistency models.