The query was fast, but the schema was wrong. You needed a new column, and everything stopped until you added it.
A new column in a database table changes application behavior at its core. It affects queries, indexes, constraints, and the way your code reads and writes data. The wrong approach can lock tables, block transactions, or trigger full table rewrites. The right approach adds the column with zero downtime.
First, choose the correct column definition. Specify the data type, nullability, and default values carefully. In PostgreSQL, adding a column with a constant default rewrites the table. Instead, add it as nullable, backfill in controlled batches, then set the default. In MySQL, certain ALTER TABLE operations copy the entire table, so plan for online schema change tools like pt-online-schema-change or gh-ost.
Second, understand index impact. A new column with an index improves query performance, but building large indexes impacts write throughput. Build indexes concurrently in PostgreSQL or use an online option in MySQL to avoid blocking.