Adding a new column sounds simple. It isn’t. In production systems, a schema change can block writes, degrade performance, and cause downtime. The stakes rise with every extra row, index, and request. If you need high availability, the way you add a new column matters.
First, define the change in a migration file rather than editing the database directly. This keeps schema updates in version control. Commit the migration alongside the code that uses it. Always backfill in controlled steps. A new column with a default value can lock the table; instead, add it nullable, deploy, then backfill in small batches. Once data is complete, enforce constraints.
Second, consider the impact on queries. Adding a new column changes plans. Indexes may need to be rebuilt. Monitor query times before and after the migration. Run EXPLAIN on the affected queries. If the table is large, use tools that apply schema changes online and avoid full table locks.