The query was slow. The product lead wanted answers. You looked at the schema and knew the fix: a new column.
Adding a new column is one of the most common database changes. It seems simple, but in production it can be risky. An extra column can break queries, cause replication lag, or lock tables in ways that hurt uptime. Getting it right means thinking about performance, data integrity, migrations, and rollback plans.
First, define the purpose of the column. Choose a name that is clear, concise, and consistent with your naming conventions. Pick the right data type to avoid wasted space or future schema changes. Plan for nullability up front. A nullable column may avoid downtime during migration but can complicate queries later.
Next, design the migration strategy. For large datasets, adding a column can lock the whole table if done in a single DDL statement. Use tools or database features that allow online schema changes. Test the migration on realistic data. Measure the impact on write performance during and after the change.