Adding a new column in a live production environment looks easy, but the wrong approach can lock rows, block queries, and crash critical services. Schema changes are one of the most dangerous operations in a database. Treat them with the same caution as deploying a major version upgrade.
Start with the data model. Define the new column with the exact type, nullability, and default value before touching production. If the column will store high-volume data, benchmark the type and indexing strategy. Avoid adding non-null columns with no default; it forces a full table rewrite and can take your system offline.
Use online schema change tools for large datasets. PostgreSQL supports ADD COLUMN operations quickly if no default is defined. MySQL requires careful use of ALGORITHM=INPLACE or external tools like pt-online-schema-change. Always check the execution plan for implicit locks.
Roll out in steps. First, add the new column as nullable with no default. Second, backfill data in small batches to avoid I/O saturation. Third, make the column required only after every row is populated. Each step should be deployed separately with monitoring in place.