Adding a new column to a database can be simple or it can risk downtime, broken queries, and lost data. The right approach depends on the database engine, index strategy, and how your application handles schema changes. Even a single ALTER TABLE ADD COLUMN statement can block writes in production if you don’t plan it well.
In SQL databases like PostgreSQL and MySQL, adding a new column without a default value is usually fast, as it updates metadata only. But when adding a default or making it NOT NULL, the engine may rewrite the entire table. For high-volume systems, that can lock tables and disrupt services. Using a nullable column with no default, followed by an UPDATE in small batches, often avoids downtime.
In document stores like MongoDB, a new column is not a schema operation in the same sense—it’s just a new field in documents. But you still need to handle old records without the field. Backfills can be done lazily, updating documents as they are read, or eagerly with careful batching.