A new column changes the math. It adds data, shape, and meaning, but it also adds cost. In SQL databases, adding a column can be instant or it can lock writes for hours, depending on the engine, schema, and data size. In PostgreSQL, adding a nullable column without a default is fast. Adding a column with a default, or one that requires backfilling, can rewrite the whole table. MySQL and MariaDB can handle instant adds under certain conditions, but not always.
Before adding a new column, define its purpose. Decide its type and constraints. Consider nullable vs. non-nullable. Set the default carefully, or avoid it entirely if the platform allows. Understand the cost of indexes—adding one during creation speeds lookups but slows inserts. If your schema is under heavy load, test the migration on a copy. Measure the time. Measure the locks.
For large datasets, consider phased rollouts. Add the new column as nullable, backfill in batches, then add constraints in a separate migration. This pattern minimizes downtime and risk, and it works well in CI/CD pipelines. Tools like pg_online_schema_change or gh-ost can help manage risk for massive tables in production.