Adding a new column seems simple. In practice, it can break queries, slow performance, or lock production writes if done wrong. Schema changes are structural changes. They demand precision, minimal downtime, and awareness of how the database engine handles them.
First, decide on the column’s purpose and data type. Use the narrowest type that meets the requirement. Smaller columns reduce storage and improve I/O. Define nullability deliberately—nullable columns can simplify rollouts, but they can also hide bad data. Add constraints only if they must be enforced at the database level.
Next, plan the migration. For Postgres, an ALTER TABLE ... ADD COLUMN is fast when adding a column with no default and allowing nulls. If you provide a default value in the same statement, older versions will rewrite the whole table, causing long locks. For large datasets, set the default in application code, backfill in small batches, then alter the column to set the default for new rows. MySQL has similar considerations depending on the storage engine and version.