Adding a new column is simple in theory but dangerous in production. Schema changes can lock tables, delay queries, and break critical code paths. The right approach to adding a new column depends on table size, system load, and versioning strategy.
In relational databases like PostgreSQL, ALTER TABLE ADD COLUMN is straightforward for small tables. On large, high-traffic tables, it can cause long locks. Use ADD COLUMN ... DEFAULT with caution—it can rewrite the entire table. Instead, add the column without a default, backfill in batches, then apply the default constraint in a separate step. This process minimizes downtime and reduces the risk of blocking writes.
For MySQL, ALTER TABLE may trigger a full table copy unless you're on a version that supports instant DDL for your modification type. Always check your database engine’s release notes for instant column addition support before deploying.
In distributed databases, schema changes can be even more complex. Adding a new column might require versioning your application code to handle both old and new schemas during rollout. Deploy the code that can read both versions first, then apply the schema change, then remove deprecated paths.