The query hit the database like a hammer, but the table wasn’t ready. You needed a new column.
A single column can change the shape of your data model. It can store critical values, enable fast lookups, or support features that weren’t possible before. In SQL, adding a column sounds simple. In production, it’s a move you plan like a deployment.
New column operations are not equal. In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward for empty tables. On large datasets, the impact depends on default values and constraints. Adding a column with a default forces a table rewrite in older versions; in newer versions, defaults can be applied instantly. MySQL, SQL Server, and other engines have their own execution paths, some blocking writes and reads.
Indexing the new column changes performance and storage requirements. Without an index, you keep write speed but sacrifice query speed. With an index, you gain faster lookups but at the cost of write performance. Every choice ripples.