Adding a new column sounds simple. In production, it is not. The risk is locked inside the schema. Poor execution can block writes, lock tables, or break queries in ways that surface only under load. Knowing how to add a column without downtime is a core skill for anyone shipping at scale.
The safest method depends on the database engine, schema size, and latency tolerance. For PostgreSQL, ALTER TABLE ADD COLUMN is fast for nullable fields with defaults set at the application layer, but can lock if you define a default in the DDL. MySQL’s ALTER TABLE can still trigger full table copies on older versions, so online schema change tools like pt-online-schema-change or gh-ost are essential for large datasets.
When adding a column to a live system, start with a feature flag or compatibility layer. Deploy code that can handle both old and new schema states before making changes. For writes, pass null or temporary placeholder values. For reads, handle missing fields gracefully until the migration completes. This dual-read/write strategy keeps your application stable during rollout.