Adding a new column sounds easy. In production, under real load, it can lock queries, block writes, and cascade into downtime. When a database runs at scale, even a small schema migration must be designed to minimize risk.
The process starts with understanding the impact. Different databases handle ALTER TABLE differently. Some lock the table until the migration is done. Others, like PostgreSQL for certain column types, can add a new column instantly with a default of NULL if no default value is set. MySQL can block updates if the alteration requires a full table rewrite. Choosing the safest path depends on the database, the size of the table, and the traffic patterns.
For large datasets, perform schema migrations online. Use tools like pt-online-schema-change for MySQL or pg_repack for PostgreSQL. These create a shadow table, copy data in chunks, and swap tables with minimal lock time. Always test the migration on production-like replicas before touching live data. Measure the time for each stage.