Adding a new column to a live database is simple in concept but dangerous in practice. Schema changes touch the core of your system. A careless ALTER TABLE can lock writes, block reads, or bring production down. You need a safe, observable plan.
First, choose the right migration method. For small datasets, a direct add with ALTER TABLE ADD COLUMN can work if performed during a low-traffic window. For large datasets, use an online schema change tool to avoid table locks. Tools like pt-online-schema-change or gh-ost copy data in the background and swap tables with minimal downtime.
Define defaults with intention. If a new column must be non-null, decide whether to populate it on creation or in a batch backfill. Backfill in small chunks to avoid overwhelming the database. Use progress tracking to detect stalls or errors.