Adding a new column changes the shape of your schema. It shifts how your application stores and serves data. Done right, it’s a clean evolution. Done wrong, it can lock queries, degrade performance, or bring production to its knees.
In SQL, the ALTER TABLE statement is the tool. A typical command looks like:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This works across PostgreSQL, MySQL, and other relational systems. But the details matter. Data types, nullability, and defaults all affect the migration cost. Adding a nullable column is fast in many engines, but adding a column with a default value can trigger a table rewrite.
In PostgreSQL, versions before 11 rewrote the table when adding a column with a default. After 11, adding a column with a DEFAULT and NOT NULL constraint is efficient. In MySQL, ALTER TABLE often copies the whole table unless certain storage engines are used. Planning the new column in line with your DB engine’s behavior avoids downtime.