Adding a new column to a database table seems simple until you run it in a system measured in millions of transactions per minute. Schema changes can block queries, lock tables, or degrade performance if executed without care. The process must be atomic, predictable, and observable.
First, verify the impact. Inspect indexes, foreign keys, and constraints. Adding a nullable column is safer, but still check for triggers or replication lag. If the column requires a default value, avoid backfilling in a single transaction on a hot table—write a batch migration instead.
For relational databases like PostgreSQL or MySQL, use ALTER TABLE ... ADD COLUMN only when confident it won’t push the table into a rewrite. For PostgreSQL, adding a nullable column without a default is usually instant. In MySQL with InnoDB, check if your version supports instant DDL; otherwise, expect locks.