Adding a new column is one of the most common schema changes. Done right, it’s fast, safe, and keeps production stable. Done wrong, it slows queries, locks tables, and limits future changes.
Start by defining the exact data type. If the new column will store IDs, use integers with constraints. For timestamps, use proper time zones and indexes to speed lookups. Always think about scale—adding a column with a heavy default can cause write locks on large datasets.
Run migrations in controlled steps. First, create the column with null values to avoid massive writes. Then backfill data in batches. This prevents connection spikes and reduces the risk of downtime. For frequently accessed columns, add indexes after backfilling to avoid slowing initial writes.