Adding a new column should be simple. Yet in production systems, it can trigger downtime, lock tables, or cause unexpected bugs. The right approach makes it safe, fast, and invisible to users.
A new column changes the data contract. Applications reading from the table must handle its presence without breaking. That means defining defaults, managing nullability, and ensuring backward compatibility with older versions of the code. Always consider how migrations will run under real load.
Best practice: add the column with a default or null, deploy the schema change, and only then roll out code that writes to it. This two-step migration prevents race conditions and avoids breaking queries from services that have not yet been updated.
For large datasets, adding a new column can lock write operations if done naively. Use online schema change tools, or chunk the migration to spread the cost. Monitor database health throughout the process.