When you add a column to a database, you alter its schema. Every table is a contract. Every column is a clause. Adding a new column means changing the agreement between code and storage. Do it right, and your application gains power. Do it wrong, and your migrations stall, lock tables, or break production.
The first step is deciding the type. An integer column behaves differently from a JSONB column. Nullability is another choice. Should the new column require a value from day one, or accept nulls until backfilled? These decisions shape how your queries run and how indexes form.
Next is performance. Adding a column in PostgreSQL with a default value can rewrite the entire table. On large datasets, this can lock resources and spike CPU. In MySQL, adding a column can be instant or blocking, depending on engine and version. Always measure the impact before running schema changes in production.
Backfilling is critical. After creating a new column, you may need to populate it from existing data. Doing this in a single transaction can cause downtime. Use batched updates to minimize load. Keep your indexes updated as new data flows in.