Adding a new column in a live database is never just a schema change. It’s an operation with cascading impact on queries, indexes, APIs, and upstream dependencies. Done wrong, it introduces latency spikes, locking, and broken deploys. Done right, it slips into production without a blip.
First, define the new column explicitly: name, type, constraints, nullability, and default values. Avoid implicit defaults unless every code path can handle them. In PostgreSQL, ALTER TABLE table_name ADD COLUMN column_name data_type is straightforward, but massive datasets need more than syntax—they require strategy.
For large tables, adding a new column with a default value locks writes until the operation completes. To prevent outages, add the column without the default, backfill in small batches, then alter it to set the default for future inserts. In MySQL, online schema change tools like pt-online-schema-change can help, but test on a replica before touching production.