Adding a new column is one of the most common schema changes in modern databases. It sounds simple, but the wrong move can lock tables, throw errors, or break production queries. The method you choose depends on your database engine, data volume, and zero-downtime requirements.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast for small tables, but on massive datasets, you should test migration scripts against a staging clone first. Use transactions carefully—long-running locks can block writes. For MySQL, ALTER TABLE can be expensive without the right engine or online DDL features. Leverage ALGORITHM=INPLACE or tools like gh-ost for safer updates.
If you work with distributed systems like CockroachDB or Spanner, schema changes propagate across nodes. Plan for propagation time. Ensure client code can handle both old and new schemas during rollout to avoid downtime. In NoSQL systems like MongoDB, adding a “column” means adding new fields to documents. This is schema-less, but you still need to handle backfilling or null values in your read paths.