The table was perfect until you needed one more field. Suddenly, the schema wasn’t enough. You had to add a new column.
Adding a new column sounds harmless. In production systems, it can be dangerous. Schema changes touch data integrity, performance, and uptime. Done wrong, they can lock tables, block queries, and crash services. Done right, they’re invisible.
Before adding a new column, define the change in clear terms. Specify the table, column name, data type, default value, and constraints. Avoid implicit defaults that can rewrite the entire table. For large datasets, use nullable columns first, backfill in batches, and only then enforce constraints.
Database engines handle ALTER TABLE differently. In PostgreSQL, adding a nullable column with no default is fast. MySQL often needs careful planning, especially on older versions. Cloud-managed databases may still have hidden limits on concurrent schema changes. Read the documentation for the engine and version you are running.