Adding a new column is one of the most common schema changes in production databases. Done well, it is fast, safe, and predictable. Done poorly, it can lock tables, block writes, and hurt performance.
The basic syntax in SQL is simple:
ALTER TABLE table_name ADD COLUMN column_name data_type;
But in production, the real work is not in the command. It is in the preparation.
Start by checking the size of the table. For large datasets, a blocking ALTER TABLE can freeze queries. Some databases, like PostgreSQL, handle adding nullable columns without touching every row. Others write every value immediately. Know your engine’s behavior before running the migration.
Use a migration tool that supports online schema changes. In MySQL, ALTER TABLE ... ALGORITHM=INPLACE can reduce locking. In PostgreSQL, adding a column with no default is instant. If you need a default value, add the column first, then backfill in batches. Monitor replication lag if you are in a multi-node setup.