The logs were clean. The only problem: the table needed a new column.
Adding a new column sounds simple. In production systems, it can be risky. The impact depends on schema size, query patterns, and deployment strategy. A poorly executed change can cause downtime, lock tables, or slow queries to a crawl.
First, define the new column’s purpose. Decide its data type, nullability, and default values before touching the database. Plan for forward-compatible changes. Adding a nullable column is usually faster and safer than adding one with a default that rewrites existing rows.
For relational databases like PostgreSQL, ALTER TABLE ADD COLUMN is the standard command. On large tables, this runs fast if there’s no default value that forces a rewrite. If the column needs a default, consider setting it after the column exists, using an UPDATE in small batches. This reduces locks and avoids long-running transactions.