The one thing to understand first
The previous article showed why strong locks held for a long time are dangerous. The art of online schema change is converting an operation that scans or rewrites the table into one that only touches the catalog — or splitting it into a fast lock plus a slow, lock-light scan.
Every safe schema change follows the same shape: make the metadata change instantly under a brief lock, then do the heavy data work (backfill or validation) separately without blocking reads and writes. Constant defaults, NOT VALID constraints, and validated-CHECK-then-SET NOT NULL are all instances of that one idea.
Adding a column with a default
Modern PostgreSQL stores a constant default as catalog metadata (a “missing value”) rather than rewriting every row. So this is fast even on huge tables: