Adding a new column should be simple. In reality, schema changes often trigger messy migrations, downtime risks, and unpredictable performance issues. A new column can block deploys, lock tables, and stall critical writes if the change is not designed carefully.
Start by defining the exact data type and constraints. Avoid generic types that lead to storage bloat or cast operations. Use NOT NULL only when data is immediately available for all rows. If you need to backfill, consider adding the column as nullable first, then populating it in batches to avoid table locks.
For large datasets, leverage online schema change tools like pt-online-schema-change, gh-ost, or native database features such as PostgreSQL’s ALTER TABLE ... ADD COLUMN for unlogged operations when possible. Always test on production-sized replicas to uncover hidden costs in index updates, triggers, or replication lag.