Adding a new column sounds trivial until it isn’t. Schema changes in production demand speed, precision, and zero downtime. The wrong command can lock rows, block queries, or break your API. The right command adds the column seamlessly, updates your code to use it, and ships without incident.
In SQL, ALTER TABLE with ADD COLUMN is the workhorse. For small tables, it’s instant. For large datasets, the database may rewrite the entire table, making careful planning essential. MySQL, PostgreSQL, and other systems differ in how they handle this. PostgreSQL supports adding nullable columns fast because it stores the default in metadata. MySQL before 8.0 often rewrites the table. Knowing these behaviors lets you choose the safest path.
When adding a new column, decide default values up front. Nulls carry risk if the application doesn’t expect them. Some teams backfill in a separate migration to avoid performance hits during deployment. For high-traffic systems, rolling out the schema change in phases reduces danger: deploy with the new column present but unused, backfill asynchronously, then switch application code.