Adding a new column should be fast, precise, and safe. In SQL, ALTER TABLE with ADD COLUMN makes it happen. The syntax is simple:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
This creates a column without touching existing rows. But speed depends on the database engine. On large tables, adding a column with a default value may lock writes or cause a full table rewrite. Test in staging. Check migration logs.
For PostgreSQL, adding a nullable column is instant. Adding a column with a constant default before Postgres 11 rewrites the table. In MySQL, watch for server version differences. Some storage engines are fast with new columns; others aren’t.
If the new column will hold computed data, consider GENERATED columns. They store a value based on other fields and can save processing time on reads.