Adding a column to a database table is not just another schema tweak. It shifts queries, indexes, and the shape of your application logic. Done right, it’s near instant. Done wrong, it stalls deployments and locks tables, costing hours or more.
A new column means deciding on type, constraints, defaults, and nullability. In SQL, the command is simple:
ALTER TABLE orders ADD COLUMN delivery_eta TIMESTAMP;
But production databases are rarely that simple. On large datasets, this can trigger a full table rewrite. Postgres, MySQL, and other engines handle this differently. Learn the specifics, or risk downtime.
Online schema changes are the safest way to add a column without blocking reads or writes. MySQL’s ALGORITHM=INPLACE and tools like pt-online-schema-change are built for this. In Postgres, adding a nullable column without a default is nearly instant, while adding one with a default may lock writes. For high-traffic apps, wrap schema changes in migrations that split the operation into stages.