A new column is one of the most common changes in a production database. Simple in concept. Dangerous in execution. Done wrong, it can lock tables, slow queries, or break code paths you didn’t know existed. Done right, it can ship in seconds without a single dropped request.
Adding a new column starts with defining its name, type, and constraints. Decide if it should allow NULLs or have a default value. In PostgreSQL, ALTER TABLE … ADD COLUMN is straightforward, but large datasets demand care. Use ADD COLUMN IF NOT EXISTS to make idempotent migrations. When defaults are needed, avoid applying them inline for huge tables. Set the column nullable first, populate it in batches, then add the constraint.
In MySQL, consider whether your storage engine and version support instant DDL. For older versions, adding a new column can trigger table copies that lock writes. Schedule downtime or use tools like pt-online-schema-change to avoid blocking.