Adding a new column to a database table looks simple. It’s one line in SQL:
ALTER TABLE orders ADD COLUMN tracking_url TEXT;
But the work is not just syntax. You have to think about performance, locking, data backfill, migrations, application code, and deploy order.
When you run ALTER TABLE, some databases lock writes until the modification completes. On large tables, that can mean seconds or minutes of blocked requests. PostgreSQL can add certain column types instantly, but others require rewriting the whole table. MySQL’s behavior depends on the storage engine and version.
If the new column needs a default value, set it carefully. In PostgreSQL, adding a column with a constant default before version 11 rewrites the table. On newer versions, it’s metadata-only. In MySQL, defaults are cheap but backfill still requires thought.
Backfilling is next. Avoid doing it in one massive transaction on production. Break it into small batches. Keep each update short to reduce replication lag and avoid locking hot rows.