Adding a new column is one of the most common schema changes in software. Done right, it is fast, predictable, and safe. Done wrong, it can block writes, break queries, or trigger costly migrations. The details matter.
When you create a new column, think about data types, indexing, and default values before writing the migration script. Each choice affects performance and compatibility. Use explicit names. Avoid nullable columns unless the logic demands it. Test against production-scale data.
For relational databases like PostgreSQL or MySQL, adding a new column can lock the table if it’s large. Run migrations in off-peak hours or use online schema change tools. In PostgreSQL, adding a column with no default value is almost instant, even for big tables. Setting a default triggers a full table rewrite—skip that if speed matters.