The query was slow, and the logs pointed at the schema. The fix was obvious: add a new column.
Adding a new column to a table is simple in syntax but complex in impact. In SQL, it often means an ALTER TABLE statement. Depending on the database engine, this can lock the table, rewrite data files, or trigger replication lag. In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast for most types when adding a nullable column with a default of NULL. In MySQL, the cost depends on the storage engine and version, with some operations requiring a full table rebuild.
A new column changes how the application reads and writes data. Every code path that touches the table must understand the extra field. Old queries may break if they use SELECT * and downstream systems parse results by position. ORM models must match the schema. APIs may need to version responses.
Creating a new column in production requires planning. First, decide the column name, type, and nullability. Second, check storage impacts and index requirements. Third, ensure backwards compatibility. Add the column, deploy code that writes to it without reading it, backfill in controlled batches, then switch reads. This multi-step migration pattern avoids downtime and data loss.