Adding a new column is a fundamental operation in schema evolution. It sounds simple, but in production, nothing is. Data size, query performance, and backward compatibility all hang in the balance. A direct ALTER TABLE ADD COLUMN on a large table can lock writes, block reads, and leave users staring at stalled requests.
The first step is defining the exact column schema. Decide the type, constraints, and default values. Explicit defaults prevent null issues and maintain predictable outputs in downstream systems. Avoid incompatible type changes later—migrations get more complex when types shift under load.
For small tables, a straightforward add is fine. For large, critical tables, use an online schema change tool. Options include native database features like PostgreSQL’s ADD COLUMN without a default, MySQL’s ONLINE DDL, or specialized tools like gh-ost and pt-online-schema-change. These approaches break the operation into smaller steps, avoiding long locks.