Adding a new column to a table is one of the most common schema changes in software development. It looks simple until it hits production. At scale, a new column in SQL or NoSQL systems can trigger locks, blow up indexes, or spike CPU under heavy write loads. Done wrong, it slows everything. Done right, it’s invisible and safe.
The first decision is type and constraints. Define the new column with the smallest data type possible. Avoid nullable columns when you need fast lookups. Set defaults where it makes sense. For relational databases like PostgreSQL or MySQL, do not combine a heavy migration with transactional logic in the same deploy. Run the schema change as an independent step.
In PostgreSQL, adding a new column with a default writes the default value to every existing row, which can be expensive. Instead, add it as nullable, then backfill in batches. For large datasets, use migration tools like pgmig or gh-ost to avoid downtime.