A new column can be a simple schema change or a dangerous migration that stalls deployment. Whether in PostgreSQL, MySQL, or distributed data stores, the operation is not equal. Some engines lock the table. Others rewrite the entire dataset. On large tables, adding a column with a default value can be slow, while adding a nullable column is often instant. Understanding the mechanics matters.
In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast when the column has no default or when using a DEFAULT of NULL. Setting a non‑null default rewrites every row, blocking writes in many cases. On MySQL with InnoDB, adding a column is online in some configurations, but older versions or certain data types can trigger a full table copy. For distributed SQL and columnar systems, the path changes again. Many support schema evolution without table-wide locks, but indexing or backfilling the new column still incurs cost.
When planning a new column in SQL, check the version, storage engine, and live workload. In production, test against a clone of the dataset. Use feature flags to roll out code that reads from and writes to the new column only after the migration completes. Monitor replication lag and query latency during changes.