Adding a new column is one of the most common schema changes, but it is also one of the most dangerous if done at scale. The wrong approach locks tables, stalls queries, and burns your deployment window. The right approach is fast, predictable, and safe.
First, define the purpose of the column. Avoid adding with a vague name or unclear type. If it must be indexed, plan for that as part of the migration, not afterward. The creation of a new column touches both schema and application logic. Coordinate both changes to avoid mismatches and runtime errors.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but large tables demand caution. Adding a non-null column with a default can force a full rewrite of data. Mitigate this by creating the column as nullable, backfilling data in batches, and then adding constraints when ready. In MySQL, similar care is needed—especially with InnoDB, where adding a column often rebuilds the table.