The database was fast, but the query stalled. The reason was simple: it needed a new column.
Adding a new column should be trivial. In practice, it is where systems break if you are not careful. Schema changes can lock tables, block writes, and cause downtime. If you deal with large datasets or high-traffic applications, the wrong ALTER TABLE runs like a slow fuse toward disaster.
First, decide if the new column is a hard requirement or if the same result can be achieved through a calculated field or an index. If the column is necessary, plan the type and constraints with care. Default values can simplify migrations, but they also rewrite every row, which can be expensive.
On smaller tables, adding a column is quick. On large tables, consider an online schema migration tool. These tools copy data to a shadow table with the new column, keep it in sync, and then swap it in without blocking. Always benchmark these operations on a staging environment with realistic data volumes before production.
Naming matters. A name should not change later. Schema drift from unclear or inconsistent names slows teams. Set clear conventions and follow them.