Adding a new column to a database table seems simple. In production, it is a change that can lock tables, slow queries, or break code. The method you choose depends on the database engine, the data volume, and the uptime requirements.
In MySQL, a direct ALTER TABLE ADD COLUMN will block writes unless you use ALGORITHM=INPLACE or an online schema change tool like pt-online-schema-change. PostgreSQL handles adding a new nullable column without rewriting the table, but adding a column with a default value before version 11 would rewrite all rows. Modern PostgreSQL versions optimize this, setting the default in metadata until a row is updated.
For distributed databases like CockroachDB or Spanner, adding a new column is often schema-safe but may require backfilling data or updating ORM mappings. Schema migrations should be version-controlled using tools like Flyway, Liquibase, or custom migration pipelines, so you can roll forward and backward without manual intervention.