Adding a new column should be fast, safe, and repeatable. In production, speed matters, but so does avoiding downtime. Schema changes can block writes, lock rows, or trigger full table rewrites. On large datasets, a simple ALTER TABLE without a plan can take minutes or hours. That’s why the method you choose is critical.
First, define the purpose. Decide on the column name, data type, default value, and whether it should allow nulls. Changes in column constraints can affect application logic and deployment order. For example, adding NOT NULL without a default will fail if existing rows do not contain values.
For most relational databases like PostgreSQL, MySQL, and MariaDB, adding a nullable column without a default is instant. Adding a column with a default often rewrites the table. In PostgreSQL 11+, defaults on new columns are applied as metadata-only changes in some cases, avoiding the full rewrite. When using older versions or other engines, test migrations in a staging environment.
In distributed systems or high-traffic services, break up the change: