Adding a new column should be fast, safe, and predictable. Whether you work with PostgreSQL, MySQL, or a modern cloud warehouse, the principle is the same: define the column, set the type, apply defaults, and migrate without breaking existing queries. Downtime is expensive. Schema changes in production can block writes and stall deployments if handled carelessly.
In relational databases, a new column can be added with an ALTER TABLE statement. This applies directly to PostgreSQL, MySQL, and MariaDB:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
For larger datasets, watch for table rewrites and locks. Some engines rewrite the entire table when adding a column with a default value. This can block reads and writes for the duration of the operation. In PostgreSQL, adding a column with a NULL default avoids a rewrite. Setting defaults afterward with UPDATE or ALTER TABLE ... SET DEFAULT can save hours.