Adding a new column is one of the most common database schema changes. Done poorly, it risks downtime, broken queries, and unhappy users. Done well, it’s invisible and safe. The difference lies in planning, execution, and knowing how your database engine behaves under change.
A new column in SQL means altering the table definition. In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but the cost depends on default values, nullability, and indexes. Adding a non-null column with a default will rewrite the table; on large datasets, that can lock writes and spike CPU. Use nullable columns first, then backfill in batches to avoid blocking.
In MySQL, ALTER TABLE can still lock reads and writes, depending on the engine and version. For large production tables, use ALTER ONLINE where supported or apply tools like gh-ost or pt-online-schema-change to avoid downtime.
Adding a computed column or using generated columns can sometimes eliminate the need to store derived data altogether. This keeps storage lean and simplifies migrations, but watch for performance trade-offs under high read load.