Adding a new column is one of the most common changes in modern databases. It sounds simple. It often isn’t. Schema changes can lock tables, slow queries, and disrupt production workloads. The right approach prevents downtime and keeps performance steady.
Start by defining the purpose. Every new column increases storage costs and affects indexes. Be clear about type, constraints, and default values. For large tables, consider adding the column without a default first, then backfilling in batches. This avoids full-table rewrites under heavy load.
For relational databases like PostgreSQL or MySQL, use transactional DDL where possible. In PostgreSQL, ALTER TABLE ADD COLUMN is fast if no default is set. MySQL may require careful coordination with online schema change tools like pt-online-schema-change or native ALTER TABLE ... ALGORITHM=INPLACE.
If the new column is indexed, create the index asynchronously. Many databases now support concurrent index builds to avoid locking writes. Monitor query plans after the change to ensure indexes are used as expected.