Adding a new column is simple in theory. In practice, it can trigger downtime, data inconsistency, and broken queries. The difference comes from how you define, deploy, and backfill that column—without locking tables or slowing production.
The first step is clarity on the schema migration path. In SQL engines like PostgreSQL or MySQL, ALTER TABLE is the basic command. But on large production tables, you cannot just run:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
That might block reads and writes for seconds, minutes, or worse. The safer approach is to use an online schema change strategy. Tools like pt-online-schema-change or gh-ost can create the new column behind the scenes, copy existing data, and swap seamlessly.
Backfilling is next. If the new column needs existing values, run this in small batches instead of one massive update. Use indexed lookups. Avoid locking the table. Log and measure the process to catch issues early.