The database was fast, but the data kept changing. A new column became the only way forward. You needed it yesterday, but the migration risk loomed. Downtime was not an option. Data loss was not an option.
Adding a new column in production sounds easy. It rarely is. Schema changes can block queries, lock tables, and spike CPU. The wrong approach can freeze an entire application. That’s why designing the right process for a new column is critical.
First, define the column. Name, type, constraints, defaults. Avoid expensive defaults on large tables. Use NULL when safe. Add data later in controlled batches. This reduces lock time and keeps read and write operations unaffected.
Next, deploy in phases. Start by adding the new column without data. Verify queries and indexes still perform. Then backfill with an idempotent script. Small batches, strong error handling, metrics on progress. Keep the main workload responsive while data fills in behind the scenes.