Adding a new column should be fast, predictable, and safe. Yet in production, it can break queries, lock tables, and cause downtime. The best approach depends on the database engine, the size of the table, and the traffic load during the change.
In PostgreSQL, adding a nullable column with no default is instant, even for huge tables. The command is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
But adding a column with a default value to an existing table triggers a full rewrite. On tables with millions of rows, that locks writes and slows reads. For large datasets, add the column as nullable first, then backfill in small batches, then set the default.
In MySQL, ALTER TABLE usually rewrites the whole table. That means downtime on large tables unless you use tools like pt-online-schema-change or native features in newer versions like ALGORITHM=INPLACE.