Adding a new column is one of the most common schema changes in software. It sounds simple. It can be dangerous. The wrong approach locks tables, stalls queries, and stalls deploys. The right approach is fast, safe, and repeatable.
Start by defining the exact data type. Avoid generic types. A VARCHAR(255) column used for integers wastes space. Match the column type to your real data boundary. Specify default values carefully—avoiding implicit defaults if possible—because defaults on large live tables can trigger a full scan.
Next, decide on nullability. Allowing NULL can give flexibility during rollout. Forcing NOT NULL often demands backfilling data before the migration completes. For high-traffic systems, backfill in batches to prevent write amplification.
Use migration tools with transactional safety where possible. On PostgreSQL, ALTER TABLE ... ADD COLUMN is fast if no default is defined. On MySQL, check the storage engine behavior—especially with older versions—to prevent locking issues. For distributed databases, consider schema drift across nodes and run migrations with versioned scripts.