Adding a new column is simple in concept but dangerous in production. It changes the structure of your data. It can block writes. It can lock tables. The wrong move can bring your system down. You need precision and timing.
In PostgreSQL, ALTER TABLE ADD COLUMN is the standard path. It’s fast for nullable columns without defaults. But adding a column with a non-null default rewrites the table. That can crush performance on large datasets. Mitigate risk by first adding the column as nullable, then backfilling in small, controlled batches, and finally enforcing constraints.
In MySQL, adding a new column may lock the table depending on storage engine and version. Use ALGORITHM=INPLACE or INSTANT where possible to avoid downtime. Test migrations in a staging environment with data sizes mirroring production.