The table was failing. Queries crawled. Reports broke. All because one missing field demanded a new column.
Adding a new column to a production database is simple in syntax, dangerous in effect. The wrong move locks tables, blocks writes, and stalls users. The right move is fast and safe. Getting it right demands knowing the engine, the schema, and the load.
In MySQL and PostgreSQL, an ALTER TABLE ... ADD COLUMN is the standard command. But standard does not mean harmless. On large datasets, adding a new column with a non-null default can rewrite the entire table. That means full table locks, I/O spikes, and downtime. Avoid defaults in the initial migration to keep it instant. Then backfill the data in controlled batches.
In PostgreSQL, adding a nullable column with no default is metadata-only and completes instantly. In MySQL with InnoDB, behavior depends on the server version; newer releases support instant DDL for certain changes. Always verify with EXPLAIN or review the documentation for your exact version.