Adding a new column sounds simple, but in production systems, it can be slow, risky, and expensive. Schema migrations can lock tables, stall queries, and generate downtime. On large datasets, a naive ALTER TABLE can freeze an application for minutes or hours.
The fastest approach is to plan the new column with precision. Choose the right data type first—avoid defaults that bloat storage. Decide whether the column should allow NULL. If a default value is needed, set it carefully; applying it to every row in one step is where operations slow down. For massive tables, consider adding the column without the default, then backfilling in smaller controlled batches.
In PostgreSQL, ALTER TABLE ADD COLUMN is usually instant if you skip the default. MySQL supports adding nullable columns without delays on some engines, but adding a NOT NULL with a default may copy the table in the background. In both systems, large-scale migrations benefit from online schema change tools that avoid write locks. Test against real production data sizes to find the actual runtime.