A PostgreSQL operations guide proposes separating the addition of new structures, small-batch data migration, read/write switching, validation and removal of old structures. Maintaining compatibility with older app versions and monitoring lock waits and replication lag preserves a rollback path. Official documentation says NOT VALID postpones immediate checks of existing rows while enforcing constraints on new changes, and subsequent VALIDATE operations also use locks. A zero-downtime label therefore does not mean lock-free execution; staged validation must reflect actual data and load.
Back to Tech
Staged PostgreSQL schema changes help manage locking risks
Separate data migration from constraint validation and use short lock-wait limits to control service delays.