Creating a new column in a production table is not trivial. Schema changes can block writes, lock reads, and stall deployment pipelines. Choosing the right strategy is the difference between a clean rollout and an outage.
In SQL, you add a new column with an ALTER TABLE statement.
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
On small tables, this runs instantly. On large ones, it can trigger table rewrites, replication lag, or worse. Modern databases like PostgreSQL, MySQL, and MariaDB differ in how they handle this internally. PostgreSQL adds new nullable columns fast because it stores a single default in the system catalog. MySQL versions before 8 can rewrite entire tables depending on storage engine and column position.
For zero downtime, you can deploy schema migrations in stages. First, create the new column without defaults or constraints. Then backfill data in batches, avoiding long-running transactions. Finally, update your application code to read and write the new column.