Adding a new column sounds simple—one line of SQL, a quick migration, and done. But in production, adding a new column can lock tables, block writes, and disrupt services. The bigger the dataset, the bigger the risk. Small mistakes in schema changes cascade into downtime.
The right approach is deliberate. First, assess the size of the table and concurrent read/write load. For large tables, use an online schema change tool like pt-online-schema-change or gh-ost. These tools create shadow tables and swap them in with minimal lock time, keeping traffic flowing.
Choose column types and defaults carefully. Adding a nullable column can be faster since it avoids rewriting existing rows. Adding with a default value may require a full table rewrite—this can mean hours of locked operations on massive datasets. Consider adding the column as nullable first, then backfilling values in batches.