Adding a new column is one of the most common and impactful schema changes in any database. It can unlock fresh features, hold vital metrics, or support migrations without breaking existing queries. But doing it wrong can block writes, trigger downtime, and erode performance. Doing it right means understanding how different systems handle column additions, and knowing when to choose online migrations over blocking DDL.
In SQL, a new column is defined with an ALTER TABLE statement. The exact syntax varies, but the principle is the same: modify the table definition to include the column name, type, and constraints. In Postgres, for example:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
In MySQL, adding a new column to a large table can cause a table lock, depending on the storage engine and options used. In modern versions, algorithms like INPLACE or tools like pt-online-schema-change can mitigate downtime. In Postgres, adding a nullable column with a default that isn’t computed is fast, because it updates only metadata, not every row. But adding a non-nullable column with a default forces a full table rewrite.