Adding a new column in a database should be deliberate, fast, and safe. Schema changes can lock tables, trigger long migrations, or disrupt live traffic. The right approach depends on the size of your dataset, the database engine, and your tolerance for downtime.
In PostgreSQL, a simple ALTER TABLE table_name ADD COLUMN column_name data_type; can create a new column instantly if no default values or computed expressions are defined. Adding a default that is not NULL will rewrite the full table, which is expensive on large datasets. To avoid this, first create the column as nullable, then backfill in small batches, and finally set the default and NOT NULL constraint.
For MySQL, adding a new column can involve a full table copy depending on the storage engine and column type. Online DDL with ALTER TABLE ... ALGORITHM=INPLACE can reduce lock times. For massive tables, tools like gh-ost or pt-online-schema-change can migrate data without downtime.