Adding a new column sounds simple, but in systems under load, schema changes can either be instant or catastrophic. The difference is in the approach.
A new column in SQL is defined with ALTER TABLE. This locks the table in many databases, blocking reads and writes. On small data sets, it’s unnoticed. On terabytes, it’s downtime. PostgreSQL, MySQL, and others have varied behaviors. PostgreSQL can add a NULL column instantly if no default is set. A DEFAULT value forces a write to every row, creating a long-running transaction. MySQL on modern versions supports instant adds for certain column types, but reverts to table rebuild for others.
For production systems, never run ALTER TABLE ... ADD COLUMN blindly. Test it. Measure on a staging copy with realistic data size. Use database-native tools like pg_osc or gh-ost to perform an online migration if the instant path isn’t supported. Keep in mind index creation on the new column can be more expensive than adding the column itself.
When planning for a new column, decide: