Adding a new column should be simple, but production systems punish carelessness. Schema changes touch live data. Every extra second of lock time is risk. Every misstep can break downstream services. The right approach depends on the size of your dataset, the database engine, and your deployment constraints.
In PostgreSQL, ALTER TABLE ADD COLUMN is instant when adding a nullable column without a default. This creates metadata only—no rewrite, no table lock beyond the catalog change. But adding a default value forces a table rewrite in older versions, so for large tables, it’s safer to add the new column without a default, backfill in controlled batches, then set the default in a later step.
In MySQL, adding a column can be blocking if the operation triggers a table copy. For heavy tables, use ALTER TABLE ... ALGORITHM=INPLACE if supported, or an online schema change tool like pt-online-schema-change or gh-ost. Keep transactions small. Avoid bulk updates in live peak hours.