Adding a new column to a database sounds simple, but in production, every change carries weight. The decision touches performance, indexes, data integrity, and the code that reads from and writes to that table. A careless ALTER TABLE can lock rows, stall queries, and push latency past safe thresholds.
First, define the column precisely. Choose the right data type to avoid waste. Use constraints only where they protect core rules. Avoid NULL defaults unless they add real semantic value. Each choice affects storage size, query plans, and replication lag.
Second, add the column in a way that avoids blocking operations. On large tables, a direct ALTER TABLE ADD COLUMN can block writes. Use tools like pt-online-schema-change or native online DDL features to stage the change without downtime.
Third, update application code in sequence. Deploy code that can handle the new column before populating it. Write backfill scripts that run in batches, keeping load below operational thresholds. Monitor replication delay, CPU, and disk I/O during the process.