Adding a new column is one of the most common schema changes in software projects. Done well, it’s fast, safe, and requires zero downtime. Done poorly, it can lock tables, block writes, or break production. The process depends on your database engine, data volume, and migration tooling.
In SQL, a new column is created with simple syntax:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
This command works in PostgreSQL, MySQL, and many others. But execution details matter. A new column with a default value may rewrite the entire table. On large datasets, this can be slow or trigger timeouts. The safer path is often to create the column as nullable, backfill in small batches, then enforce constraints.
In PostgreSQL 11+, adding a new column with a constant default is optimized. MySQL has similar improvements in recent versions. Still, you must know your production environment. Run migrations off-peak. Monitor locks. Apply changes behind feature flags when schema updates affect application logic.