Adding a new column sounds simple. In production, it can be dangerous. The wrong approach locks tables, blocks writes, and forces downtime. The right approach works in seconds, even at scale.
A new column changes the shape of your database. Start by defining its purpose and data type. For relational databases, choose types that match existing constraints and indexes. Avoid expensive defaults on large tables. Use NULL for initial creation to prevent full-table rewrites.
In PostgreSQL, ALTER TABLE ADD COLUMN runs fast if no default value is set. In MySQL, the storage engine matters. In modern versions of InnoDB, some additions are instant, but older versions require a table copy. On distributed databases like CockroachDB or Yugabyte, schema changes propagate cluster-wide; plan the rollout to avoid performance spikes.
When adding a column to high-traffic systems, run schema migrations in safe, reversible steps. First, deploy the nullable column. Then backfill values in small batches to avoid lock contention. After data is ready, apply constraints and indexes in separate migrations.