The queries are fast. But the table needs a new column.
Adding a new column sounds simple. In production, it is not. Schema changes can lock tables, impact performance, and trigger downtime if handled poorly. The right approach ensures zero disruption while keeping data accurate and query plans stable.
First, define the new column with exact types and constraints. Avoid vague defaults. If you need migrations, use tools that support transactional DDL where possible. For large datasets, deploy changes incrementally. Backfill in small batches to reduce load on the database.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but watch for operations that require a rewrite of the entire table. For MySQL, consider the storage engine and online DDL capabilities. Always profile the impact before rolling out.