The database was fast, but the product team needed more. The feature spec was clear: a new column in the table, deployed without downtime, safe under load, and ready for production within minutes.
Adding a new column is not trivial at scale. Schema migrations change data structures that live at the core of every query. A careless ALTER TABLE can lock writes, stall reads, and break critical services. The path from local development to production must be precise and repeatable.
The first decision is how to define the new column. You need the name, data type, default value, and constraints. In relational databases like PostgreSQL or MySQL, these choices impact storage, indexing, and query performance. Even if the column starts empty, indexes or defaults can trigger full-table updates that crush throughput.
To avoid downtime, use an online schema change process. For PostgreSQL, tools like pg_repack or pg-osc can add a column incrementally. MySQL users often rely on gh-ost or pt-online-schema-change. These tools hold locks for microseconds, not hours, by copying data behind the scenes and switching tables atomically.