A new column in a relational database should be simple, but in production it often carries risk. Schema changes can lock tables. They can block queries. They can cascade into outages. The way you add a new column depends on your database engine, the table size, and your tolerance for blocking operations.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward for small tables. It’s fast because it records the column metadata only. But defaults and NOT NULL constraints can trigger a full-table rewrite. That rewrite can be slow, blocking reads and writes. To avoid this, add the column without defaults, backfill in small batches, then apply constraints.
In MySQL, altering large InnoDB tables the old way is unsafe in production. The solution is online DDL. Features like ALGORITHM=INPLACE and LOCK=NONE allow you to add columns without locking rows for reads and writes. For very large tables, tools like pt-online-schema-change or gh-ost reduce downtime by creating a shadow table and migrating data in the background.