The schema had been stable for months. Then the product team asked for a field that didn’t exist. You need a new column.
Adding a new column is one of the most common tasks in database management. Done wrong, it can cause downtime, lock tables, or break queries. Done right, it should be fast, clean, and safe in production. The key is knowing which method to use for your environment.
First, define the column’s purpose. Decide on the data type, default value, and whether it should allow nulls. Plan for indexing if queries will filter or join on it. Avoid adding unnecessary indexes that will slow inserts and updates.
In relational databases like PostgreSQL or MySQL, ALTER TABLE is the standard approach to create a new column. For large datasets, consider adding columns in a way that prevents long locks—such as using ADD COLUMN with defaults set in a separate step. Some systems allow online schema changes, which help keep services running during migration.