Adding a column to a production table is simple in theory, dangerous in practice. Done wrong, it locks rows, slows writes, or even takes the application offline. The safest approach depends on the database engine, the table size, and the budget for downtime.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast when the column has no default. Postgres stores the column definition in the metadata and fills nulls implicitly. Adding a default value with NOT NULL forces a table rewrite—potentially hours on large datasets. To avoid that, add the column without defaults, backfill data in batches, then set constraints.
MySQL behaves differently. In modern versions with ALGORITHM=INPLACE, adding a nullable column can still require a rebuild depending on the storage engine and version. For huge tables, use pt-online-schema-change or tools built into cloud platforms to perform non-blocking migrations.