Adding a new column to a database is simple in syntax but not in impact. Whether it’s PostgreSQL, MySQL, or a columnar store, each storage engine handles a schema change differently. Some apply it instantly. Others lock the table. The wrong choice can take your system down.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast if you add a nullable column with no default. But setting a default with the statement forces a full rewrite. At scale, that’s dangerous. Use the ADD COLUMN first, then UPDATE in batches. Finally, set the default with ALTER COLUMN SET DEFAULT. This avoids downtime.
MySQL has similar pitfalls. Modern versions with ALGORITHM=INSTANT can add a column without a table copy, but only under specific constraints. If you miss them, it reverts to a copy operation. Always check SHOW WARNINGS after the DDL.