Adding a new column seems simple, but it can break queries, cause downtime, or stall deployment if handled carelessly. Schema changes in production must be safe, fast, and invisible to users. The right approach avoids long locks, preserves data integrity, and keeps application code in sync.
Start by defining the purpose of the new column. Identify which services will read and write to it, and decide the data type, default values, and constraints. Avoid arbitrary defaults unless the business logic demands them. Incorrect choices here will cost more to fix later than the schema update itself.
For large tables, use an online schema migration. PostgreSQL, MySQL, and other relational databases have tools or extensions to add new columns without locking the entire table for write operations. With Postgres, ALTER TABLE ... ADD COLUMN is often fast for small tables, but adding NOT NULL with a default to millions of rows can be expensive—better to add the column as nullable, backfill in batches, then enforce constraints when ready.