Adding a new column sounds simple. It never is. The right approach depends on scale, database engine, indexing strategy, and the demands of uptime. At a small scale, an ALTER TABLE statement can work instantly. At billions of rows, it can lock writes, spike CPU, and stall replication.
In relational databases like PostgreSQL, you can add a new column instantly if it has a default of NULL. But if you set a non-null default, the database rewrites the whole table. In MySQL, an ALTER TABLE often rebuilds the table unless you use algorithm clauses like ALGORITHM=INPLACE or ALGORITHM=INSTANT where available. This difference changes the downtime risk.
Online schema changes solve this. Tools like pg_repack, gh-ost, and pt-online-schema-change let you roll out a new column without locking the main table. They work by creating a shadow table, copying data in the background, and swapping it in at the end. This pattern avoids service disruption in production systems with high traffic.