The database was ready, but the schema was wrong. You needed a new column, and every second counted.
Adding a new column sounds simple. In practice, it can break applications, lock tables, and slow production queries. The key is understanding how your database handles schema changes and choosing the right method for your workload.
Most relational databases support the ALTER TABLE command to add a new column. This works, but it often locks the table. On large datasets, that lock can block reads and writes for minutes or hours. For high-traffic systems, that’s downtime you cannot afford.
To avoid blocking, many teams use online schema changes. Tools like pt-online-schema-change for MySQL or ALTER TABLE ... WITH (ONLINE = ON) in SQL Server allow you to add columns without locking the entire table. In PostgreSQL, adding a column without a default value is fast, since it updates only the metadata. Adding a column with a default requires rewriting the whole table unless you use DEFAULT with NULL and backfill later.