Adding a new column sounds simple. In production, it can be a trap. Schema changes touch code paths, migrations, deployments, and sometimes downtime. The right approach starts with understanding the constraints of your database engine and the impact on storage and performance.
In SQL databases, ALTER TABLE is the standard way to add a new column. On small tables, it’s instant. On large ones, it can block writes or read queries, depending on the engine and configuration. PostgreSQL can add a column with a default value of NULL without a table rewrite, but adding a NOT NULL column with a default will rewrite the entire table. MySQL behaves differently, and older versions can lock the table for the duration of the operation.
For high-traffic systems, you reduce risk by adding the column without defaults or constraints first. Then backfill data in batches to avoid load spikes. Once data is complete, add constraints in a separate migration. Always run schema changes behind feature flags or conditional code to ensure backward compatibility during deploys.