The query ran fast, but the schema lagged. You needed a new column, and you needed it without breaking production.
A new column in a database table is more than a structural change. It alters storage, query plans, and sometimes application behavior. Adding it well means precision: defining data types, defaults, nullability, indexing, and migration strategy without downtime.
The first step is to decide how the new column will be created. For large datasets, use online schema changes or partitioned rollouts. On systems like PostgreSQL, a simple ALTER TABLE ADD COLUMN can lock writes if not done carefully. Avoid adding a column with a default value on huge tables unless your database supports instant metadata-only changes.
Plan the column definition. Choose data types that match the smallest size possible for the use case. Use NOT NULL with defaults if application logic depends on the column immediately. Avoid TEXT or VARCHAR with no limits unless justified.