Adding a new column in a live database is a high‑risk operation. Done wrong, it locks tables, spikes latency, and drops queries. Done right, it slips into production without anyone noticing—except the metrics.
A new column starts with design. Decide the type, constraints, and default values. Avoid NULL if you can. Think through indexing. Every extra index can slow writes, but missing indexes can sink reads.
In SQL, adding a column seems simple:
ALTER TABLE orders ADD COLUMN processed_at TIMESTAMP;
In large tables, this can trigger a full table rewrite. On some databases, this locks the table until the operation is complete. That could be minutes or hours. Instead, use an online schema change tool like gh-ost or pt-online-schema-change for MySQL, or the CONCURRENTLY options in PostgreSQL where possible.
Plan for backfilling the data in batches to avoid load spikes. Monitor replication lag if you have replicas; schema changes can break replication if not compatible.