The query hit production at 2:13 a.m., and the database locked up. Logs showed the same pattern: a missing index and a new column added without planning.
A new column sounds simple. In most systems, it is not. Adding a new column to a live table changes schema, impacts queries, and can block writes. In relational databases, an ALTER TABLE ADD COLUMN on large datasets can cause downtime if not executed with care. In distributed systems, schema changes can ripple through services, caches, and ETL pipelines.
Before adding a new column, define its purpose and data type. Choose defaults and constraints that reflect how the column will be used in queries and code. Avoid nullable columns unless the absence of data is a valid state. If you store timestamps, use a uniform timezone and format.
For online schema changes, use tools that operate in chunks or create shadow tables. MySQL engineers often reach for pt-online-schema-change or gh-ost. PostgreSQL can add nullable columns instantly but still locks when adding constraints or indexing. Test on production-like datasets to measure performance impact.