Adding a new column should be simple. In real systems, it can be painful. Schema changes lock tables. Migrations fail under load. Deploys stall. Data pipelines break. Production incidents follow.
The first step is to define the exact column type and constraints. Choose NULL or NOT NULL with purpose. Decide on defaults. These decisions shape performance and data integrity.
In systems with millions of rows, adding a new column can be dangerous. On PostgreSQL, certain operations rewrite the whole table. On MySQL, the storage engine and version control how quickly the change completes. For distributed databases, you must manage the update across shards without downtime.
Good practice is to stage the migration. First, add the column as nullable without defaults. Let the change propagate. Then backfill in small batches to avoid locking. Only after the data is present should you switch to NOT NULL or add indexes.