The schema was good until it wasn’t. A product change came fast, and now the database needs a new column. The sprint is tight. The deploy window is small. The data must survive intact.
Adding a new column sounds simple. In reality, the wrong approach can lock tables, block writes, and break downstream systems. Whether you work with PostgreSQL, MySQL, or other relational databases, you need a process that is safe, fast, and repeatable.
First, define the new column with precision. Choose the correct data type and constraints up front. Changing them later under load is risky. If the column must be NOT NULL, create it as nullable first, then backfill, then add the NOT NULL constraint in a separate step.
Second, protect performance. On large tables, even an ALTER TABLE can stall traffic. Use tools and strategies that avoid full-table rewrites. PostgreSQL’s ADD COLUMN is usually fast, but adding defaults or indexes can be costly. For MySQL, look at ALGORITHM=INPLACE or ALGORITHM=INSTANT where possible.