Adding a new column in a database should be fast, predictable, and safe. Yet in production systems, schema changes can turn into a slow, high‑risk operation. Understanding how to add a column without downtime is a core skill for scaling any system.
A new column can be added with a simple ALTER TABLE statement. In small datasets, this runs instantly. In massive tables, it can lock writes, create operational delays, or cause replication lag. Choosing the right approach depends on the database engine, schema design, and traffic patterns.
In MySQL, ALTER TABLE often copies the entire table when adding a column. Tools like gh-ost or pt-online-schema-change can perform this as a non-blocking background process. PostgreSQL behaves differently for certain column types—adding a nullable column with no default is nearly instantaneous, because it stores the definition in metadata rather than rewriting rows. Setting a default value or adding constraints changes that behavior and may require a full table rewrite.