Adding a new column is simple in theory, but in production it’s a precision operation. Schema changes touch live data, indexes, queries, and application logic. A single mistake can lock tables, spike latency, or cause cascading errors across services.
The process starts with the ALTER TABLE statement. For smaller datasets, it’s fast. For large, high-traffic systems, the operation can be dangerous if done without planning. Online schema change tools like gh-ost or pg_repack can add a new column without blocking writes, but they require careful monitoring.
Defaults and nullability matter. Adding a non-null new column with a default value forces a rewrite of every row. On a terabyte-scale table, this can freeze the database. Many teams add the column as nullable first, then backfill in batches, and finally enforce constraints in a second migration.
Indexes should be added last. Creating them inline with the new column can pile read and write locks on top of the schema change. Isolate these steps and roll them out with feature flags to control exposure.