The query hit the table hard. A new column had to be added, and it had to be done without breaking production.
Adding a new column in a live database is not just a schema change. It’s an operation that touches storage, indexing, query plans, replication, and application code. When you add a new column, you change the shape of your data model. That change can cascade through every query, migration, and service that consumes the table.
The safest way to add a new column is to plan the operation in phases. First, create the column with a default value of NULL to avoid locking the entire table. Then backfill the column in small batches, monitoring performance and error rates. Finally, update the application code to write and read from the new column once data integrity is confirmed.
Consider the impact on indexes. Adding an indexed column increases write latency and can spike CPU usage during creation. Avoid creating the index until after the backfill completes. If the column will be queried often, benchmark the read performance before and after adding the index.