When you add a new column to a database table, you change the shape of your application’s data model. Done right, it unlocks features. Done wrong, it locks your service into downtime, broken deployments, or performance hits.
Adding a new column in SQL seems simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
But under the hood, engines handle this differently. In PostgreSQL, adding a nullable column without a default is fast and metadata-only. Adding a column with a default rewrites the table and can stall writes. In MySQL, ALTER TABLE may rebuild the table entirely, depending on storage engine and version.
For large datasets, that means hours of locked migrations unless you use online DDL tools. PostgreSQL 11+ can add a column with a constant default without table rewrite. MySQL’s ALGORITHM=INPLACE can help, but not always. You need to check query plans, storage engine capabilities, and migration logs before running on production.